1. Introduction
With technological advancement and growing awareness on how fossilfuelbased energy generation is contributing unprecedentedly to global warming and climate change, more and more people are adopting ecofriendly distributed energy resources (DERs) (e.g., harnessing the Sun’s energy using solar photovoltaic cells). Despite the fact that DERs producing energy from renewable energy sources (RESs) have weatherdependent output, they are increasingly becoming common in different parts of the world (they are growing both in numbers and production capacity) [
1,
2,
3]. Generally, the energy produced from DERs is distributed within a cluster, and the energy exchange market is in charge of facilitating the energy trading. However, as the consumerowned DERs are increasing in numbers and so does their production, direct and distributed energy trading is required not only among consumers but also among the utility companies and consumers [
3,
4]. Therefore, this brings about the necessity of an energy broker, which allows to trade energy among DERs [
4]. In order to manage energy use and trade efficiently, the IoTbased smart agents [
5,
6] can facilitate communication between these DERs and the energy broker, thereby allowing sharing information (e.g., energy generation and consumption information). In addition, when these smart agents are applied, new DERs can be added to the consumer side with the existing deployed DERs without modification of operation (e.g., grid connected mode/isolated mode) [
7]. Unlike the existing independent system operator (ISO) [
8], an energy broker is equipped with energy storage systems (ESSs), and it can purchase electricity from the sellers and sell directly to the buyers. It can even store the purchased energy in its ESS(s) and sell later. Note that the ISOs may form wholesale power markets where the power transmission operators, utilities and power consumers can trade.
Due to these energy trading shifts from the conventional energy exchange to energy brokers, dynamic pricing is considered for balancing energy demand and distribution [
9]. At a power grid, based on monopolistic energy trading, fixed pricing is effective for forecasting demand and deciding on the required amount of electricity generation. However, when it comes to trading energy in a DERbased smart grid, the dynamic pricing is more effective in balancing consumers’ demand as well as reducing the cost of energy distribution. To encourage DER owners to produce energy from RESs, a number of effective measures have been taken. To verify whether the energy is produced from an RES, an energy broker may invoke a DER to provide a renewable energy certificate (REC) [
10,
11]. RECs are US marketable, intangible energy products that demonstrate the ability to generate and transmit 1MWh of electricity from suitable RESs to the consumers through the power distribution network. Therefore, the DERs that do not provide RECs may not be allowed to trade energy. Furthermore, RECs are a tradable commodity, and they can be used for energy trading. In Europe, to differentiate consumption between RESs and the conventional energy, the Guarantees of Origin (GO) certificate has been introduced [
12]. Similarly, in the USA, Republic of Korea, and India, the government and utility companies are encouraging energy providers to use RECs when taking part in energy trading. Undoubtedly, incorporating REC in energy trading can bolster the investment in deploying RESbased DERs so as to reduce the carbon footprint for energy production. Therefore, a dynamic pricing policy and demand control need to be investigated taking into account DER energy generation and energy providers’ RECs trading in an energy brokerorientated trading market.
Previous research findings in [
13,
14,
15,
16,
17,
18,
19] impart that a dynamic pricing approach has a strong influence on energy providers’ profit and consumers’ energy demand. According to the proposal in [
13], a group of users opts for buying energy at a fixed price, while the other group chooses dynamic pricing. The authors in [
13] consider an energy provider’s revenue and demand in their proposal. However, according to this proposal, the users are not equipped with DERs and energy storage facilities. Furthermore, in their solution, the authors assume that a user acts only as a consumer (i.e., a user does not become part of an energy trading). In [
14], the authors propose a novel dynamic pricing scheme in order to provide users with a price certainty as well as guaranteed uninterrupted power supply. The authors demonstrate how historical market data can contribute to making their scheme successful in energy sharing. Perhaps a serious disadvantage of this scheme is that it does not consider a broker model. In [
15], the authors aim at increasing the availability of renewable energy. In order to attain this goal, they introduce a contractbased adaptive pricing mechanism based on RES distribution. Additionally, in their solution, users are equipped with ESSs in order to reduce peak energy demand. However, this contribution in [
15] would have been far more convincing if the authors had considered operation and energystorage cost of the batteries in their performance analysis. In [
16], a dynamic pricing algorithm is proposed in order to detect spiteful users and insecure energy providers. However, according to this solution, the users only consume energy and do not sell any energy from their DERs to an energy market. In [
17], both consumers’ demand and energy providers’ profit are taken into account in a Stackelberg game in order to determine a dailyahead hourly pricing. Similar to [
14], the authors of [
16] do not consider an energy broker, which plays a pivotal role in maximizing the profits of energy providers and consumers. In [
18], the authors propose a fair dynamic pricing scheme to reduce peak demand based on real datasets and guarantee energy providers’ revenue. However, in their energy trading solution, consumers are not equipped with DERs. In [
19], a dynamic pricing broadcasting scheme is proposed based on domestic load management. Authors consider that the energy providers have DERbased microgrids (MGs) and, similar to [
13], the consumers do not participate in energy trading in their scheme. In [
20], the authors introduce a dayahead market where the market participants (consumers and energy providers) commit to buy or sell wholesale electricity one day prior to the operating day so as to avoid price volatility. Thus, in a dayahead market, prices have a greater impact on demand. However, this study falls short in explaining how the demand of the consumers varies under different conditions (e.g., presence and the type of DERs). In [
21], a usagebased dynamic pricing with privacy preservation for smart grid is proposed. The authors claim that as the proposed work enables the dynamic prices to take into account electricity usage, it can contribute to minimizing consumption costs while maximizing utility for both retailers and consumers. In [
22], the authors propose a rolling horizon distributed probability control approach for demandside management of smart grids using wind turbines. Unlike the solution in [
22], where a distributed demandside management was proposed, taking into consideration the wind power forecasting uncertainty, our solution introduced in this paper considers uncertainty in actual PV generation data, which is widely used in households. In [
23], the authors present a multipurpose probability optimization model for multiple MGs. In particular, optimal stochastic energy management is proposed to address multiple MGs structures with the aim of minimizing total cost and emissions, but our proposed solution embodies energy marketbased modeling for energy trading.
In particular, the existing studies had some limitations, as the focus was on the benefits of energy trading only from the consumer’s perspective if the residual energy after the consumption was traded. Therefore, based on this premise, if the consumer trades the remaining energy into the REC where an energy provider can buy to reduce greenhouse gases (GHGs), the consumer essentially benefits from the energy trading. In addition, since energy providers can benefit from the reduction of carbon emissions by purchasing these RECs, REC trading benefits energy providers as well as consumers. Consequently, if existing studies were focused only on profit optimization from an energy seller’s perspective, the proposed study addressed demand and pricing optimization for both sellers (i.e., consumers) and buyers (i.e., energy providers) in consideration of REC, which has few previous studies.
In this paper, we investigate a dynamic pricing and demand control mechanism to maximize the profits of a single energy provider and consumers. The energy provider produces energy from its conventional energy sources (e.g., nuclear and thermal) and buys RECs from the DERs. The DER owners (i.e., consumers) also use ESSs in order to store energy for future use.
In particular, the contributions of this work are stated as follows:
Contrary to the existing energy trading, we propose a new energy trading model facilitated by an energy broker, which also uses ESS in order to compensate for the fluctuating output from the energy generators. Particularly, the clean energy sources (DERs) and the conventional energy can be traded through the proposed energy broker where an energy provider and consumers participate in.
To design the proposed energy trading model, we define an energy consumer model and energy provider model to maximize the benefits of energy consumers and providers. The energy consumer model includes a consumer utility function, an ESS cost function, and an RES cost function. On the other hand, the energy provider model considers a generation cost function and an RES trading profit function.
In detail, we define demand and pricing decision problems considering RECs, RESs, ESSs, and their operation costs. First, to maximize the profit of the energy provider, we design an energy provider model, which decides optimal dynamic price for selling and the optimal amount of RECs that the energy provider ought to buy. Next, we design an energy consumer model to obtain the optimal energy demand from the energy provider while reducing the operation cost of RESs and ESSs.
Via welldesigned utility and functions, we formulate a demandbased optimization problem and optimal dynamic pricing decision to maximize the utilities of the energy provider and consumers. Using dual decomposition based on the convex optimization, we obtain the optimal Dynamic Selling through Dynamic Buying (DSDB) scheme, which runs at the energy broker in a dayahead market.
Finally, the results obtained through numerical simulation show that the proposed DSDB scheme outperforms the conventional pricing schemes. Furthermore, we evaluate our proposed DSDB using realworld energy market data where there exist various patterns of energy demand and energy generation.
The rest of this article is organized as follows.
Section 2 presents details of our proposed demandbased trading mechanism, which includes the proposed energy provider model, consumer model, and optimization formulation. Numerical results with performance comparison depending on pricing strategy are presented in
Section 3. Finally, we conclude the paper in
Section 4.
2. Proposed DemandBased Trading Mechanism with Dynamic Pricing Model of Renewable Energy Sources
We propose a demandbased trading mechanism with dynamic pricing for both selling and buying of energy in this section. We refer to our proposed scheme as DSDB in the subsequent part of this paper. According to the DSDB scheme, the selling and buying price of energy for a consumer is set dynamically by the energy broker in order to maximize total utility. In other words, with this proposed approach, consumers are charged a dynamic selling price and provided with a dynamic buying price by the energy broker. Using this scheme, the consumers can control their energy demand depending on the buying price as well as sell their own RES energy in the case when a higher selling price is offered. In this paper, we define RES energy as capacity (i.e., kW) per hour for RES.
Considering an energy broker market where consumers are capable of producing energy from their DERs and participate in energy trading, we propose our system model, as depicted in
Figure 1. Consumers have DERs with PVbased energy generation capability and ESS for storing energy. When they are willing to sell their residual energy to the energy broker, they may provide REC voluntarily or they might be asked to provide it by the energy broker so as to comply with imposed environmental policies, similar to [
11]. In our proposal, to supply energy, the energy provider may rely on consumers’ DERs besides its own conventional energy sources (e.g., nuclear and thermal). In other words, in our solution, the energy provider has only its conventional energy sources, and it may buy RECs when the energy from its own sources is not sufficient to meet the energy supply of the consumers at a given time. In our proposal, similar to [
6], we consider that the consumers have a smart energy agent (SEA), which is a type of smart meter with the capability of communicating with other SEAs when it comes to trade energy. Additionally, we assume that an SEA allows not only a consumer to make the energy request but can also autonomously make an energy request to the energy broker if it is authorized by the consumer. In order to facilitate energy tradingrelated communication among the consumers and energy broker, we consider two messages: (i) energy request message, which incorporates the amount of required energy, and (ii) energy availability message, in which an energy provider states the amount of available energy it has and the per unit cost for trading.
The SEAs can be mounted on energy providers, energy brokers, and energy consumer sides. Therefore, information, such as power generation, energy price, consumption, and renewable energy trading can be defined as distributed local information in their respective areas, and global information can be updated over the communication network to update their local information again. Therefore, for energy brokers, the centralized framework processes the local information received from each SEA and provides updated information to each of the SEAs. As suggested in [
7], the functionality of SEA can also change the information decision policy from a centralized to distributed manner. Therefore, the framework allows SEAs located anywhere in the system to participate in the management of energy trading technically and economically. The proposed solution can be deployed in both centralized and multiagent frameworkbased SEA. It is worth note that both frameworks have their strengths and weaknesses in terms of privacy, computational and communication overhead, and implementation complexity. As suggested in [
24], it is necessary to consider the tradeoff of both cases. One possible solution for determining the most appropriate one would be is to consider the number of participating agents. That is, a centralized framework can be applied when the number of components for energy trading is small, whereas a distributed case (multiagent frameworkbased SEA) can be selected when the number of components is relatively larger.
The notations that are used for mathematical expressions presented in the subsequent part of this paper are tabulated in
Table 1.
2.1. Energy Consumer Model
We formulate the quantity of energy used by the $i$th consumer based on the $k$th unit time slot as ${x}_{i,k}$. The lower and upper bound of energy consumption of the $i$th consumer are described as ${m}_{i}$ and ${M}_{i}$, respectively. Therefore, we can describe the characteristic of ${x}_{i,k}$ as ${m}_{i}$ ≤ ${x}_{i,k}$ ≤ ${M}_{i}$. The energy from RESs is stored in the consumer premises, and the consumers have the authority to decide upon the amount of energy to resell to the energy broker for each unit time slot.
Then, let us define
${g}_{i,k}$ as the quantity of RES energy resold to the energy broker by the
$i$th consumer in the
$k$th unit time slot, and
${L}_{i}$ =
$\left\{{l}_{i,t}\rightt=1,2,...,T\}$ clearly states the RES energy produced for the purpose of
$i$th consumer. We suppose that the produced curve function of RES generators is allowed. Since the quantity of resold RES energy cannot exceed the quantity of preserved energy, we can consider the inequality constraint condition of
${g}_{i,k}$ as follows:
The RES energy is resold here, which implies that the PVs of consumers have produced energy during the day. The consumer then produces and spends for its own energy and stores the remaining energy in the ESS. It also sells the remaining ESS energy to the energy broker during highpriced hours. Furthermore, we can take into account the stored energy capacity of an ESS as
${C}_{i}$. We can also consider the quantity of energy preserved in the
$k$th unit time slot as
${c}_{i,k}$. Finally, we can describe the quantity of energy filled up from the electric grid (
${e}_{i,k}$≥ 0) or discharged to the electric grid (
${e}_{i,k}$≤ 0) by the
$i$th consumer in the
$k$th unit time slot as
${e}_{i,k}$. Therefore, we can formulate the quantity of energy in the energy storage as
The ESS of the
$i$th consumer, in general, has a maximum charging and discharging rate defined as
${e}_{i,max}$ and
${e}_{i,min}$, respectively. Therefore, we have the inequality constraints as follows:
2.1.1. Consumer Utility Function
We can formulate the different consumer behavior based on a differentiated selection of various utilitybased functions [
25]. We can describe
$U(x,\delta ,s)$ as the equivalent utility function for all consumers. Here,
x is the level of energy usage for the consumer,
$\delta $ is the variable of maximum charging of an ESS, which may differ among consumers at dissimilar unit times of a given day, and
s is the quantity of the energy selling level of the consumer. Specifically, the utility function describes the level of consumer satisfaction that consumers experience from charging ESS and selling energy as a function of its energy usage for each consumer. Therefore, we suppose that the consumer utility functions meet the following properties according to different consumers.
 (I)
Utility function is nondecreasing. This implies mathematically that
 (II)
A marginal benefit function is defined as
The above marginal benefit of a consumer is nonincreasing. Therefore, it can be rewritten as
That is to say, the utility function is concave. This implies that the satisfaction level of the consumers can gradually become saturated.
 (III)
We assume that without energy consumption, there is no utility. Namely, we can present this as
There are various choices of utility functions in the literature to formulate the satisfaction of energy consumers. From the aspect of microeconomics, we model the reactions of different consumers by using the concept of utility function [
25]. Here, we define
$U({x}_{i,k},{\delta}_{i,k},{s}_{i,k})$ as the utility function for each consumer, where
${x}_{i,k}$ indicates the quantity of energy used within the
$k$th unit time slot in the
$i$th consumer,
${\delta}_{i,k}$ represents the quantity of maximum charging of the ESS in the
$k$th unit time slot by the
$i$th consumer, and
${s}_{i,k}$ represents the quantity of energy selling to energy broker in the
$k$th unit time slot by the
$i$th consumer. We can take the different utility functions by choosing a disparate value of
${\delta}_{i,k}$. To be specific, the utility function
$U({x}_{i,k},{\delta}_{i,k},{s}_{i,k})$ represents the level of satisfaction for each consumer with the quantity of charging of ESS
${\delta}_{i,k}$, energy
${x}_{i,k}$ consumed, and energy sold to the energy broker in the
$k$th time slot by the
$i$th consumer. We assume that the ESS is used for reducing the demand request to the energy broker and that the quantity of energy consumed by the consumer does not exceed the capacity of the ESS. Therefore, we assume that the
$i$th consumer will have the highest satisfaction when its consumption reaches the ESS capacity. Furthermore, even if it consumes more than that, the satisfaction remains constant as there is no energy stored in the ESS. Here, we apply a utility function with a quadratic function [
26,
27], defined as
where
${x}_{i,k}$ indicates the quantity of energy consumed by
$k$th unit time slot in the
$i$th consumer,
${w}_{i}$ (i.e., demand weight factor) is the
$i$th given consumer’s preference,
${\delta}_{i,k}$ is the quantity of maximum charging of ESS in the
$k$th unit time slot by the
$i$th consumer, and
${s}_{i,k}$ is the quantity of energy sold to the energy broker in the
$k$th unit time slot by the
$i$th consumer.
2.1.2. Cost Function of ESS Operation
The ESS operation cost depends on how much and how speedily it charges and discharges energy. Consequently, it is assumed that the ESS operational cost function
${C}_{ESS}$ presents a convex function of
${e}_{i,k}$ [
28]. The ESS operational cost function with the parameters
$\xi $$(\xi >0)$ and
$\kappa $$(\kappa \ge 0)$ is
where
${e}_{i,k}$ is the quantity of energy charging and discharging by the
$k$th unit time slot by the
$i$th consumer,
$\xi $ is the slope coefficient parameter (e.g., slope of a battery type) and
$\kappa $ is the initial energy level of the battery,
${d}_{i,k}$ is the quantity of energy stored in the
$k$th unit time slot by the
$i$th consumer, and
${D}_{i}$ is ESS capacity of the
$i$th consumer.
Lemma 1. The proposed ${C}_{ESS}\left({e}_{i,k}\right)$ has a convex function and a unique solution for the quadratic ESS operational cost model.
Proof. From Equation (
10), we can rewrite
where
${e}_{i,k}>0$,
$\xi >0$ and
$\kappa \ge 0$. For
${C}_{ESS}\left({e}_{i,k}\right)$, the ESS operational cost function stems from
$\frac{\partial}{\partial {e}_{i,k}}{C}_{ESS}\left({e}_{i,k}\right)>0$,
$\frac{{\partial}^{2}}{{\partial}^{2}{e}_{i,k}}{C}_{ESS}\left({e}_{i,k}\right)>0$. Therefore, the proposed ESS operational cost function
${C}_{ESS}\left({e}_{i,k}\right)$ is a convex function and a unique solution for
${e}_{i,k}$. □
2.1.3. Cost Function of RES Energy
The selling cost of the energy from a RES generator is described as a function
${C}_{RES}\left({g}_{i,k}\right)$ associated with the quantity of energy sold. In particular, this cost is determined based on two factors as we can notice from (
12). The first and second terms in (
12) are the operation cost of an ESS and the maintenance and repayment installation cost of the RES generator during its continuous cycle of life, respectively.
Therefore, the cost function of the RES energy is formulated as follows:
where
${g}_{i,k}$ is the quantity of the RES energy sold to the energy broker by the
$k$th unit time slot by the
$i$th consumer,
$\zeta $ is a slope coefficient parameter (e.g., slope of battery type)
$(\zeta >0)$,
$\eta $ is average cost per unit of the RES energy and
${p}_{i,l}$ is the RES energy output for the
$i$th consumer.
2.2. Energy Provider Model
We indicate the energy generated from the energy provider within the $k$th unit time slot as ${G}_{k}$. The energy provider furnishes a lower bounded energy ${G}_{k,min}$ to fulfill the overall smallest energy demands of all consumers in the $k$th unit time slot. In addition, the energy provider also guarantees an upper bounded energy ${G}_{k,max}$ to include the largest demands of all consumers to avoid system blackout due to energy deficiency. Moreover, the energy provider determines how much energy it needs to generate and how much RES energy it needs to repurchase. We describe ${R}_{k}$ as the quantity of RES energy that the energy provider purchases from consumers in the $k$th unit time slot.
2.2.1. RES Energy Trading Profit Function
We present how the energy provider can turn carbon footprint reductions into substantial profits through RECs trading. The Kyoto Protocol grant offsetting is a way for government and private enterprises to obtain carbon credits that they could trade in the marketplace [
29]. Carbon emissions can also be addressed through RES systems, the shape of RECs or the RES energy purchased by utilities, and carbon offsets by GHG reporting programs. Therefore, a profit function for RECs trading can be summarized as
where
$F\left({M}_{k}\right)$ denotes the profit function in the
$k$th unit time slot,
P indicates the price value per unit carbon emissions (
P > 0), and
${M}_{k}$ shows the quantity of carbon footprint in the
$k$th unit time slot. The relationship of
P and
${M}_{k}$ based on financial marketbased trading theory [
30] can be expressed as
Equation (
15) indicates the market price of energy falls when supply increases. This can be again stated as follows:
where
${M}_{k}$ is the quantity of carbon emission
$({M}_{k}>0)$,
${R}_{k}$ is
${R}_{k}$ unit RES energy
$({R}_{k}>0)$ in the
$k$th unit time slot,
$\lambda $,
$\mu $, and
$\tau $ are slope coefficient parameters
$(\lambda ,\mu ,\tau >0)$, respectively.
The relationship between carbon emissions and RES energy is represented as
${M}_{k}=\tau {R}_{k}$. This shows we are able to lessen
$\tau {R}_{k}$ unit carbon emission through purchasing
${R}_{k}$ unit REC. For example, energy utilities in the Republic of Korea emit 0.517 kg of carbon in producing 1 kWh of energy [
31]. The energy provider lessens their comprehensive carbon emissions by 0.517 kg by purchasing 1 kWh of energy from RESs. Therefore, the profit function relevant to the quantity of RES energy can be presented as
2.2.2. Generation Cost Function
We describe
${C}_{G}\left({G}_{k}\right)$ as the cost for the energy provider to generate
${G}_{k}$ energy. The cost function is modeled as [
27,
28,
32]
where
${G}_{k}$ is the energy generated by the energy provider in the
$k$th time slot.
$\alpha $,
$\beta $, and
$\gamma $ is quadratic/linear/no load coefficient parameter
$(\alpha >0,\beta \ge 0,\gamma \ge 0)$, respectively.
2.3. DemandBased Optimization Problem Formulation
In this subsection, we formulate the demandbased optimization problem [
33]. To find a solution to the problem efficiently in a convex dual manner, the primal problem is taken apart into a consumer subproblem and an energy provider subproblem. After that, we propose two dual mechanisms for each part. In the viewpoint of consumers’ demand, we can express a unit timeslotdependent demandbased trading optimized formulation, which is a convex problem that maximizes the total utility. That is to say, the total utility means that the total profit of all consumers increases as the profit of the energy provider increases. Therefore, we can state the following optimization problem under several constraints:
where
H =
$\{{x}_{i,k},{\delta}_{i,k},{s}_{i,k},{e}_{i,k},{g}_{i,k},{R}_{k},{G}_{k}\mid i\in N,k\in K\}$,
$\omega $ is a weight factor for profit per energy consumption,
$\psi $ is a weight factor for the ESS price ratio, and
$\chi $ is a weight factor for the ESS capacity ratio.
The inequality constraint in (
20) shows that the net demand of all consumers cannot go over the energy supply limit from the energy provider in each unit time slot. The equality constraint in (
21) presents that the total selling quantity of RES energy for all consumers should be equal to the purchasing quantity of the energy providers in every unit time slot.
In addition, firstly, all elements of the objective function in (
19) represent concave properties or convex properties. Secondly, inequality and equality constraints in (
20) and (
21) denote linear functions. Thirdly, the feasible set represents a convex set. Finally, the objective function in (
19) shows the concave function. Thus, the proposed problem can be resolved centrally by convex programming manners as a convex optimization problem. Furthermore, to ensure consumer privacy, we will solve the demandbased trading problem in a convex dual decomposition scheme [
15,
33,
34,
35].
Dual Decomposition to Primal and Subproblem
To effectively solve the problem in a dual decomposition scheme, the primal problem is transformed to a dual problem through a Lagrange function. Finally, the Lagrange dual function for dual decomposition is proposed. Therefore, we require to modify the inequality and equality constraints in (
20) and (
21), respectively, so as to differentiate between the consumer and the energy provider by using Lagrange multipliers. Thus, by applying this technique, we can easily solve the problem in (
19).
Here, firstly, we require to reconfigure the parameters
${x}_{i,k}$,
${e}_{i,k}$,
${g}_{i,k}$, and
${G}_{k}$ in inequality constraint (
20) and parameters
${g}_{i,k}$ and
${R}_{k}$ in equality constraint (
21). For the decomposition of the primal problem of (
19), we can describe the Lagrangian as [
15,
33,
34,
35],
where
$\nu $ and
$\mathit{o}$ are Lagrange multipliers, which are defined as
$\{{\nu}_{k}\mid k\in K\}$ and {
${o}_{k}$$\mid k\in K\}$, respectively.
Moreover, the Lagrange dual function is expressed in (
23).
where the constraints (
20) and (
21) are mitigated by Lagrangian (
22), and we can revise (
22) as
Due to the individuality of consumers, the duality function in (
23) can be reformulated as
For clarity, (
25) can be organized as
For simplicity, (
26) can be rewritten as
where
At this point, a consumer subproblem (
28) and an energy provider subproblem (
29) have been taken apart from the Lagrange dual function. Moreover, by setting buying price
${\nu}_{k}$ and selling price (
${\nu}_{k}$ +
${o}_{k}$) in the aspect of the consumer’s view, subproblems (
28) and (
29) are the same as the consumer welfare function and the energy provider profit function, respectively. Consequently, we can write the Lagrange dual problem as follows:
Here, we convert the primal problem (
19) to the dual problem (
30). After that, we pursue a solving method with respect to the dual problem. Since the primal problem indicates convex function and the slater’s condition is retained for the primal problem, strong duality holds. Thus, the duality gap indicates 0.
Consequently, instead of finding a solution to a primal problem, we can find a solution to a dual problem.
2.4. Gradient Iteration Method for DemandBased Trading
In this subsection, we design our demandbased trading mechanism with a dynamic pricing model of RESs to find a solution concerning the dual problem. Here, we can find a solution to the problem iteratively using the gradient projection method [
36] as follows:
Here,
$\mathit{l}\in \rho $,
$\rho $ presents the set of repetition parameters, and
$\tau $ indicates the step size in the gradient method. We indicate
${\mathit{x}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})$,
${\mathit{g}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ and
${\mathit{e}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ as the optimization tool of subproblem (
28) concerning
$i$th consumer, and
${\mathit{R}}^{*}({\nu}^{l},{\mathit{o}}^{l})$,
${\mathit{G}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ as the optimization tool of subproblem (
29) with a given
${\nu}^{l}$,
${\mathit{o}}^{l}$ concerning energy provider.
Thus, we can present two kinds of algorithms to seek a solving method of the dual problem that represents the consumer and energy provider aspects. Initially, Algorithm 1 decides to acquire the values of
${\mathit{x}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})$,
${\mathit{g}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ and
${\mathit{e}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ by solving the subproblem in (
28) given pricing information
${\nu}^{l}$ and
${\mathit{o}}^{l}$ from the energy provider. Second, Algorithm 2 decides the values of
${\mathit{R}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ and
${\mathit{G}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ by solving subproblem in (
29) through the response information
${\mathit{x}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})$,
${\mathit{g}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ and
${\mathit{e}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ obtained from every consumer in addition to the updated values of
${\nu}^{l}$ and
${\mathit{o}}^{l}$.
Algorithm 1 Consumer’s Demand Decision Algorithm 
 1:
procedureConsumer Demand (${\nu}^{l},{\mathit{o}}^{l}$)  2:
while each $l\in \rho $ do  3:
get ${\mathit{x}}^{*}({\nu}^{l},{\mathit{o}}^{l})$, ${\mathit{g}}^{*}({\nu}^{l},{\mathit{o}}^{l})$, ${\mathit{e}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ by solving subproblem ( 28) for the given ${\nu}^{l},{\mathit{o}}^{l}$ 4:
send consumer’s demand ${\mathit{x}}^{*}({\nu}^{l},{\mathit{o}}^{l})$, ${\mathit{g}}^{*}({\nu}^{l},{\mathit{o}}^{l})$, ${\mathit{e}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ to the energy provider  5:
end while  6:
return ${\mathit{x}}^{*}({\nu}^{l},{\mathit{o}}^{l})$, ${\mathit{g}}^{*}({\nu}^{l},{\mathit{o}}^{l})$, ${\mathit{e}}^{*}({\nu}^{l},{\mathit{o}}^{l})$  7:
end procedure

Algorithm 2 Energy Provider’s Dynamic Pricing Decision Algorithm 
 1:
procedurePricing Information (${\mathit{x}}^{*}$, ${\mathit{g}}^{*}$, ${\mathit{e}}^{*}$)  2:
while each $l\in \rho $ do  3:
adjust ${\mathit{R}}^{*}({\nu}^{l},{\mathit{o}}^{l})$, ${\mathit{G}}^{*}({\nu}^{l},{\mathit{o}}^{l})$ by solving subproblem ( 29)  4:
update pricing data as follows  5:
${\nu}^{l+1}={\left[{\nu}^{l}\tau \left({\sum}_{i}^{N}\left({\mathit{g}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l}){\mathit{x}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l}){\mathit{e}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})\right)+{\mathit{G}}^{*}({\nu}^{l},{\mathit{o}}^{l})\right)\right]}^{+}$  6:
${\mathit{o}}^{l+1}=\left[{\mathit{o}}^{l}\tau \left({\sum}_{i}^{N}\left({\mathit{g}}_{\mathit{i}}^{*}({\nu}^{l},{\mathit{o}}^{l})\right){\mathit{R}}^{*}({\nu}^{l},{\mathit{o}}^{l})\right)\right]$  7:
dispatch updated pricing data to every consumer  8:
end while  9:
return ${\nu}^{l+1},{\mathit{o}}^{l+1}$  10:
end procedure

2.5. Overall DemandBased Trading Mechanism
In short, the overall demandbased trading mechanism with RESs works as follows: From the first hour of the day, the energy provider firstly establishes a selling price ${\nu}^{0}$ and a repurchasing price (${\nu}^{0}+{\mathit{o}}^{0}$), which are announced to the consumers through the energy broker. After receiving the information, every consumer makes an attempt to maximize their own profit with relevant price data and sends a corresponding response to the energy provider. After reflecting the response information of consumers’, the energy provider adjusts new prices to maximize profits, and then dispatches the updated new dynamic pricing data to all the consumers. Therefore, the dynamic pricing strategy procedure makes up an iterative linkage structure between consumers and the energy provider. If this linked structure is convergent at the starting point of a given day, the selling price $\nu $ and the repurchasing price ($\nu +\mathit{o}$) are secured.
Hence, if the energy provider configures the selling price as
$\nu $ and the repurchasing price as (
$\nu +\mathit{o}$), the consumers maximize their profits. Therefore, dynamic pricing and demand decision sequence flows in Algorithms 1 and 2 present interactive interactions between the energy provider and consumers, as depicted in
Figure 2.
3. Performance Evaluation and Discussion
We perform intensive simulations to indicate that the proposed method is able to accomplish demandbased energy trading for the grid and total utility for the consumers.
3.1. Simulation Assumption
The proposed simulated demandbased trading system environment comprises an energy provider and 100 residential consumers, and each of them is equipped with a PV and an ESS. We suppose that all the consumers install and operate a 5 kW PV system and a 6 kW ESS at their residential areas. The average generating cost of a 5 kW PV system is around 79.93 Korea won (KRW) per kWh (USD 0.0687 per kWh), and the battery capacity of an ESS is 6 kWh for residential areas. Although the our mathematical formulation can be extended by considering the residential areas with different ESS capacities, for the sake of simplicity, we suppose that the ESSs deployed in residential areas have the same capacity in this performance evaluation. At this point, it is worth noting that in a real deployment scenario, the residential users deploy lithiumionbased accumulator batteries in order to attain desired capacity. According to [
37], the price of such batteries would be 1500 USD/kWh.
Figure 3 demonstrates the electricity output performance on a clear sunny day of a PV that is installed in an electronics and telecommunications research institute testbed [
38,
39], Republic of Korea. From this figure, we notice that the PV provides at least 1 kWh of output power of around 33% of a day.
We assume that every consumer has different minimal and maximal bound of energy demand requirement. The decision variables we consider here have real values. Each consumer’s preference
w is arbitrarily decided within a range from 0.5 to 6.5. Additionally, in our performance evaluation, we use real market data from independent electricity system operator market report [
40] in order to present the consumers’ energy demand pattern on a given day, as depicted in
Figure 4 as the input of 100 residential consumers’ demand preference. Demand preference means that consumers with higher preference are likely to use more energy.
3.2. DemandSideBased Resource Operation Performance Comparison
We measure the total energy demand of consumers under three different cases, with different resource configurations on the consumer side: (i) the consumers do not have both PV and ESS, (ii) the consumers have only ESS, and (iii) the consumers have both PV and ESS.
As depicted in
Figure 5, the third case relatively reduces more peaktime energy demand than other cases because consumers are able to resell RES energy to the energy broker when they are equipped with both ESS and PV. The results in
Figure 6 indicate that the third case shows no sharp fluctuation in demand, resulting in the smallest variance in consumer demand. Therefore, in this case, the consumers’ demand is adequately satisfied, and they will have an uninterrupted power supply due to having their own PV and ESS.
Figure 7 presents that the third case has the smallest peaktoaverage ratio as well. Additionally, we notice from this figure that, in this case, the consumers’ demand during peaktimes does not fluctuate abruptly. This indicates that a power outage is less likely to occur in this case. Therefore, we conclude that when consumers are equipped with both PV and ESS, they can have more stable energy supply compared to the other two cases.
3.3. Analysis of Various DemandBased Trading Strategies
According to our proposed DSDB scheme, a consumer has a dynamic selling and buying price of energy, which is decided by the energy broker. In this subsection, we want to evaluate this proposed scheme with three other conventional schemes, which are stated below:
 (I)
Fixed Selling through Fixed Buying (FSFB) scheme: According to this scheme, the consumers are charged with a fixed selling price and provided with a fixed buying price [
9], which is the most common scheme in conventional smart grids. In this strategy, consumers are provided with energy based on personal preferences without taking the price into account. Therefore, there is no incentive for consumers to manage the timing of reselling RES energy to the energy broker deliberately.
 (II)
Fixed Selling through Dynamic Buying (FSDB) scheme: This strategy charges consumers a fixed selling price and provides consumers with a dynamic buying price for RES energy.
 (III)
Dynamic Selling through Fixed Buying (DSFB) scheme: This strategy allows the consumers a dynamic selling price and provides them with a fixed buying price for RES energy [
28]. In this strategy, consumers do not store RES energy for later selling but prefer to sell the residual energy instantly at a dynamic price.
Next, we evaluate DSDB (proposed scheme), DSFB, FSDB and FSFB under the case where the consumers are equipped with both PV and ESS. Furthermore, we analyze those four strategies of pricing based on the proposed total utility.
In this performance evaluation, we consider that the energy broker is equipped with an ESS. When the energy provider produces more energy than the consumers’ demand, the residual energy will be discarded inefficiently. Currently, an ESS is expensive to install, but the cost of its installation will gradually decline with technological advancements in the foreseeable future. Bearing this in mind, we consider that the energy broker will be equipped with a lowcost ESS in the coming days. This will allow the energy broker to store the residual energy and sell it to the consumers when necessary. Considering that the energy brokers would have lowcost ESS for storing energy in the future, we want to evaluate those four strategies.
First of all, for evaluating those four strategies, we consider the current installation cost of an ESS. The installation cost of an ESS 1 MWh is about KRW 540 million in the Republic of Korea (USD 464,117) [
41].
Figure 8 demonstrates the total utility performance for DSDB, FSFB, DSFB, and FSDB. The total utility is quantified by summing up the value of the overall profit during each unit time slot in 24 h. The summary of the results, which is stated in
Table 2, indicates that DSDB outperforms the other three strategies (see the first row).
In view of this case when ESS cost would be reduced in the future, let us consider that the installation cost of an ESS 1 MWh is about KRW 5 million in the Republic of Korea (USD 4297). With the drop of an ESS price, we surmise that the number of energy brokers with ESS will increase significantly in the future. Considering such a case, we present the total utility of those four strategies in
Figure 9. In this case, the total utility is measured taking into account the installation cost of an ESS. The summary of the result is presented in
Table 2 (see the second row). We can notice from this table that the highest profit (229.1 cents) is achieved when DSDB is applied, while the lowest profit (200.1 cents) can be made when FSFB is used.
In a nutshell, in both cases (i.e., an energy broker with lowcost and highcost ESS), our proposed DSDB provides the highest total utility among all the strategies. However, looking at this table, one can realize that when an ESS price is low, DSDB leads to ensuring 3.52% more profit compared to the case when the price is high.