A Stackelberg Game-Based Approach for Transactive Energy Management in Smart Distribution Networks

Recently, with the penetration of numerous Distributed Energy Resources (DER) in Smart Distribution Networks (SDN), Local Transactive Markets have emerged. Exchanging energy between all participants of local markets results in the satisfaction of producers and consumers. Based on these issues, this study provides a novel framework for the participation of SDN-independent entities in wholesale and local electricity markets simultaneously. In this regard, the considered system’s players, namely Distribution System Operator (DSO) and DER Aggregator (AG), take part within local as well as wholesale markets in two-day ahead and real-time stages. Moreover, to deal with the inherent conflict between the existing players’ interests, a Stackelberg game-based technique is proposed. In the raised competition, the leader, DSO, attempts to minimize its operating costs, while the follower, DER AG, tends to maximize its profit. Therefore, actors’ actions choices within both markets are made non-cooperatively. On the other hand, to handle the uncertain nature of stochastic parameters in the depicted problem, Monte Carlo Simulation (MCS), together with a fast backward/forward scenario reduction approach, is exploited. Ultimately, to evaluate the efficiency of the proposed scheme, two different case studies, with and without considering the competitive environment, are implemented on a modified IEEE-33 bus SDN.


Introduction
Currently, the number of Distributed Energy Resources (DERs) is increasing dramatically in Smart Distribution Networks (SDNs). Accordingly, although the presence of these resources at the distribution level leads to the improvement of reliability, flexibility, voltage profile, etc., Distribution System Operators (DSOs) are confronted with various dilemmas in terms of optimal scheduling and energy management of their networks. This is because, on one hand, a large number of small-scale DERs must be managed by the DSO due to their inability to participate in wholesale markets. On the other hand, with the privatization of ownership in SDNs, the DSO has to interact and trade with private DERs in an economic and effective way [1]. The reason for this is that existing independent entities have a tendency to promote their own interests through participating in the DSO's energy management program. Based on these facts, one promising solution for the efficient participation of these emerging entities in the optimal operation of novel distribution systems is designing a Local Electricity Market (LEM) in a Transactive Energy (TE) environment. The existence of the LEM helps local DERs to have the TE exchange with other units at the distribution level. In addition, these small-scale DERs are able

Novelty and Contributions
Analyzing the introduced works indicates that, generally, the optimal scheduling of SDNs has not been investigated in the presence of both WEM and LEM at the same time. Indeed, in these studies, some participants of distribution networks have not been allowed to be involved in the WEM. On the other hand, independent financial entities have not been considered to take part in various markets as strategic operators. Hence, these studies have not been able to present a solution for modeling a competitive environment among all market players. Furthermore, in several models, a suitable platform has not been provided for the coordination and collaboration of decentralized DERs. As a Energies 2020, 13, 3621 4 of 32 result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows: • Designing a distinct LEM to create a novel platform for the TE exchange at the distribution level. • Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system. • Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other. • Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM. DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows: Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.  Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.  Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this research is to study the optimal scheduling of SDNs in the TE environment by considering both LEM and WEM. The studied SDN has two Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows: Presenting a Stackelberg game-based approach to model a TE environment exchanged energy between autonomous financial entities and the DSO results in th of the system.  Providing a novel framework in which all participants of the distribution netwo take part in separate markets that have no exchange between each other.  Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, structure and characteristics of the available markets, are explained in more detail. Af uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this research is to study the optimal s SDNs in the TE environment by considering both LEM and WEM. The studied S Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa   [7]   [8]   [9]   [10]   [11]   [12]   [13]   [14]   [15]   [16]   [17]   [18]   [19]   [20]   [21]   This Paper    Designing a distinct LEM to create a novel platform for t  Presenting a Stackelberg game-based approach to m exchanged energy between autonomous financial entitie of the system.  Providing a novel framework in which all participants take part in separate markets that have no exchange bet  Determining an AG of decentralized DERs to establish a between various energy sources for the purpose of trad The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the opt structure and characteristics of the available markets, are ex uncertainty modeling and mathematical formulations of the

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this researc SDNs in the TE environment by considering both LEM autonomous players, namely DSO and DER AG. In this rega the required electricity demand of customers, maintaining th contrast, the AG, as a mediator, aggregates and coordinate participate in both markets effectively. As for the WEM, i market, and its clearing mechanism is based on the double a [7] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows:  Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM. The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this research is to study the optimal scheduling of Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows:  Designing a distinct LEM to create a novel platform for the TE exchange at the distr  Presenting a Stackelberg game-based approach to model a TE environment exchanged energy between autonomous financial entities and the DSO results in th of the system.


Providing a novel framework in which all participants of the distribution netwo take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, structure and characteristics of the available markets, are explained in more detail. Af uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this research is to study the optimal s Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.  Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.  Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows: The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows: The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, structure and characteristics of the available markets, are explained in more detail. Af uncertainty modeling and mathematical formulations of the problem are stated.
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the opt structure and characteristics of the available markets, are ex uncertainty modeling and mathematical formulations of the

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this researc SDNs in the TE environment by considering both LEM autonomous players, namely DSO and DER AG. In this rega the required electricity demand of customers, maintaining th [11] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows:  Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this research is to study the optimal scheduling of SDNs in the TE environment by considering both LEM and WEM. The studied SDN has two autonomous players, namely DSO and DER AG. In this regard, the DSO is responsible for providing Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows:


Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, structure and characteristics of the available markets, are explained in more detail. Af uncertainty modeling and mathematical formulations of the problem are stated.
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the opt structure and characteristics of the available markets, are ex uncertainty modeling and mathematical formulations of the [12] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows:  Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this research is to study the optimal scheduling of SDNs in the TE environment by considering both LEM and WEM. The studied SDN has two Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows:


Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, structure and characteristics of the available markets, are explained in more detail. Af  The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the opt structure and characteristics of the available markets, are ex [13] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows:  Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this research is to study the optimal scheduling of Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows:


Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the opt [14] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows:  Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows:


Providing a novel framework in which all participants of the distribution netwo take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the opt [15] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows:  Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows: Table 1. A comparison between the current study and previous research works.

Ref. Participation of the SDN's Entities in both WEM and LEM Stackelberg Game-Based Approach for Local TE Trading Coordination Decentralized D an Independen
Designing a distinct LEM to create a novel platform for the TE exchange at the distr  Presenting a Stackelberg game-based approach to model a TE environment exchanged energy between autonomous financial entities and the DSO results in th of the system.


Providing a novel framework in which all participants of the distribution netwo take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4. [16] Energies 2020, 13, x FOR PEER REVIEW 4 of 34

Materials and Methods
DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows: Table 1. A comparison between the current study and previous research works.

Coordination of Decentralized DERs by an Independent AG
Designing a distinct LEM to create a novel platform for the TE exchange at the distribution level.
 Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows: Table 1. A comparison between the current study and previous research works.

Ref. Participation of the SDN's Entities in both WEM and LEM Stackelberg Game-Based Approach for Local TE Trading Coordination Decentralized D an Independen
Designing a distinct LEM to create a novel platform for the TE exchange at the distr  Presenting a Stackelberg game-based approach to model a TE environment exchanged energy between autonomous financial entities and the DSO results in th of the system.


Providing a novel framework in which all participants of the distribution netwo take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa Table 1. A comparison between the current study a Ref.

Stackelberg Ga Based Approach Local TE Tradi
Designing a distinct LEM to create a novel platform for t  Presenting a Stackelberg game-based approach to m exchanged energy between autonomous financial entitie of the system.


Providing a novel framework in which all participants take part in separate markets that have no exchange bet  Determining an AG of decentralized DERs to establish a between various energy sources for the purpose of trad The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the opt structure and characteristics of the available markets, are ex uncertainty modeling and mathematical formulations of the [17] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows: Table 1. A comparison between the current study and previous research works.

Coordination of Decentralized DERs by an Independent AG
Designing a distinct LEM to create a novel platform for the TE exchange at the distribution level.
 Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows: Table 1. A comparison between the current study and previous research works.

Ref. Participation of the SDN's Entities in both WEM and LEM Stackelberg Game-Based Approach for Local TE Trading Coordination Decentralized D an Independen
Designing a distinct LEM to create a novel platform for the TE exchange at the distr  Presenting a Stackelberg game-based approach to model a TE environment exchanged energy between autonomous financial entities and the DSO results in th of the system.


Providing a novel framework in which all participants of the distribution netwo take part in separate markets that have no exchange between each other.


Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa Table 1. A comparison between the current study a Ref.

Stackelberg Ga Based Approach Local TE Tradi
Designing a distinct LEM to create a novel platform for t  Presenting a Stackelberg game-based approach to m exchanged energy between autonomous financial entitie of the system.


Providing a novel framework in which all participants take part in separate markets that have no exchange bet  Determining an AG of decentralized DERs to establish a between various energy sources for the purpose of trad The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the opt structure and characteristics of the available markets, are ex uncertainty modeling and mathematical formulations of the [18] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows: Table 1. A comparison between the current study and previous research works.

Coordination of Decentralized DERs by an Independent AG
Designing a distinct LEM to create a novel platform for the TE exchange at the distribution level.
 Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.
 Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows: Designing a distinct LEM to create a novel platform for the TE exchange at the distr  Presenting a Stackelberg game-based approach to model a TE environment exchanged energy between autonomous financial entities and the DSO results in th of the system.


Providing a novel framework in which all participants of the distribution netwo take part in separate markets that have no exchange between each other.
 Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, a structure and characteristics of the available markets, are explained in more detail. Af Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4. [19] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows: Table 1. A comparison between the current study and previous research works. Ref.

Coordination of Decentralized DERs by an Independent AG
Designing a distinct LEM to create a novel platform for the TE exchange at the distribution level.
 Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.
 Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows: Designing a distinct LEM to create a novel platform for the TE exchange at the distr  Presenting a Stackelberg game-based approach to model a TE environment exchanged energy between autonomous financial entities and the DSO results in th of the system.


Providing a novel framework in which all participants of the distribution netwo take part in separate markets that have no exchange between each other.
 Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, a The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi [20] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows: Table 1. A comparison between the current study and previous research works. Ref.

Coordination of Decentralized DERs by an Independent AG
Designing a distinct LEM to create a novel platform for the TE exchange at the distribution level.
 Presenting a Stackelberg game-based approach to model a TE environment in which the exchanged energy between autonomous financial entities and the DSO results in the equilibrium of the system.


Providing a novel framework in which all participants of the distribution network are able to take part in separate markets that have no exchange between each other.
 Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows: Designing a distinct LEM to create a novel platform for the TE exchange at the distr  Presenting a Stackelberg game-based approach to model a TE environment exchanged energy between autonomous financial entities and the DSO results in th of the system.


Providing a novel framework in which all participants of the distribution netwo take part in separate markets that have no exchange between each other.
 Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, a The rest of this article is organized as follows: The rais [21] Energies 2020, 13, x FOR PEER REVIEW 4 of 34 DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows:  Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows:  Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.

Materials and Methods
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fi weaknesses, the main contributions of the article are summa DERs. As a result, since this research is conducted to fill the entire aforementioned gaps and weaknesses, the main contributions of the article are summarized as follows:  Determining an AG of decentralized DERs to establish an appropriate cooperative environment between various energy sources for the purpose of trading energy in both WEM and LEM.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.
Energies 2020, 13, x FOR PEER REVIEW DERs. As a result, since this research is conducted to fill the entire aforemention weaknesses, the main contributions of the article are summarized as follows:  Determining an AG of decentralized DERs to establish an appropriate cooperative between various energy sources for the purpose of trading energy in both WEM a The rest of this article is organized as follows: The raised problem, utilized frame formulations are described in Section 2. The numerical studies are provided in Section article is concluded in Section 4.  The rest of this article is organized as follows: The rais formulations are described in Section 2. The numerical studi article is concluded in Section 4.
The rest of this article is organized as follows: The raised problem, utilized framework, and its formulations are described in Section 2. The numerical studies are provided in Section 3. Finally, the article is concluded in Section 4.

Materials and Methods
In this part, firstly, the presented approach for the optimal scheduling of SDNs, as well as the structure and characteristics of the available markets, are explained in more detail. Afterwards, the uncertainty modeling and mathematical formulations of the problem are stated.

Proposed Methodology and Markets Structure
As mentioned earlier, the primary goal of this research is to study the optimal scheduling of SDNs in the TE environment by considering both LEM and WEM. The studied SDN has two autonomous players, namely DSO and DER AG. In this regard, the DSO is responsible for providing the required electricity demand of customers, maintaining the security and stability of the system. In contrast, the AG, as a mediator, aggregates and coordinates local distributed resources in order to participate in both markets effectively. As for the WEM, it is assumed that this market is a spot market, and its clearing mechanism is based on the double auction [22]. Hence, for each timeslot t, a tuple (t, q, p) is presented to the market, in which q is the bid/offer of participants for the energy, and p is the proposed price of that bid/offer. On the other hand, it is presumed that the pricing mechanism in the WEM Energies 2020, 13, 3621 5 of 32 is the uniform pricing in which all winners are paid at a market-clearing price regardless of their actual bids [23]. As a result, the mentioned players bid at the market cap price and offer at the zero price in order to be sure of the acceptance of their proposals by the market operator [24]. Concerning the LEM, owing to the presence of autonomous financial entities with different objective functions, and the necessity of interaction with one another at the distribution level, a Stackelberg game-based approach is selected to model the TE trading between independent players of the market. That is due to the fact that with a game-based method, the selfish behavior of all the agents can be satisfied, and a win-win situation is established among them [25]. In this market, for the sake of simplicity, the price of traded energy is assumed to be constant. This assumption is highly prevalent (albeit relatively coarser). On the other hand, generally, the exchange mechanism between the WEM and LEM can be categorized into three different types: Neutral Link, Competition Link, and finally, No Link [26]. Based on these, in this research, it is assumed that there is no direct link between these two kinds of markets. The outline of the considered scheme and the interaction between the introduced players in various markets are illustrated in Figure 1.
Energies 2020, 13, x FOR PEER REVIEW 5 of 33 tuple ( ) t,q,p is presented to the market, in which q is the bid/offer of participants for the energy, and p is the proposed price of that bid/offer. On the other hand, it is presumed that the pricing mechanism in the WEM is the uniform pricing in which all winners are paid at a market-clearing price regardless of their actual bids [23]. As a result, the mentioned players bid at the market cap price and offer at the zero price in order to be sure of the acceptance of their proposals by the market operator [24]. Concerning the LEM, owing to the presence of autonomous financial entities with different objective functions, and the necessity of interaction with one another at the distribution level, a Stackelberg game-based approach is selected to model the TE trading between independent players of the market.
That is due to the fact that with a game-based method, the selfish behavior of all the agents can be satisfied, and a win-win situation is established among them [25]. In this market, for the sake of simplicity, the price of traded energy is assumed to be constant. This assumption is highly prevalent (albeit relatively coarser). On the other hand, generally, the exchange mechanism between the WEM and LEM can be categorized into three different types: Neutral Link, Competition Link, and finally, No Link [26]. Based on these, in this research, it is assumed that there is no direct link between these two kinds of markets. The outline of the considered scheme and the interaction between the introduced players in various markets are illustrated in Figure 1. purchased power from the upstream grid during peak hours, and promote the efficiency of the network as well as the welfare of market participants [27]. In this game, the DSO, as the leader of the problem, seeks to minimize its total operating costs by exchanging power in both local and wholesale markets. In turn, the AG, as the follower of the problem, maximizes its profit by making the connection with DER producers and market operators. In this procedure, the exchanged power between agents in the LEM acts as linking variables of the upper and lower levels. As a result, based on the local and wholesale market prices, the DSO sends its bids/offers for purchasing/selling energy in the LEM to the DER AG. These proposals enter into the optimization problem of the DER AG as input parameters and, according to these values, the AG decides on its own decision variables, including the traded energy in the WEM, generated power of dispatchable units as well as charged/discharged power of the compressed air energy storage (CAES). Then, the DSO optimizes its objective function and evaluates the total operating costs by taking into account decisions that are returned from the follower to the leader.
Nevertheless, in the provided scheme, each independent organization is faced with a large number of uncertainties, including market prices, electricity demand, wind speed, and solar irradiance. In order to cope with these types of uncertain factors, a scenario-based two-stage stochastic programming method is used. In two-stage models, normally, two kinds of decisions are made: here-and-now or first-stage decisions and wait-and-see or second-stage decisions [28]. Based on the latter reference and the above descriptions, in the first stage of this paper, existing players determine their optimal involvement in the DA WEM and DA LEM, as well as the output power of their dispatchable sources prior to the realization of stochastic variables. In the next stage, after learning the actual value of uncertain parameters, these entities decide on their participation in the RT WEM and RT LEM, as well as power adjustments of available units.

Uncertainty Characterization
As mentioned previously, in the depicted model, there are five uncertain parameters, namely, RT WEM price, RT LEM price, wind speed, solar radiation, and three types of electric demand. For the realization of these random variables, the primary issue is to generate scenarios in such a way as to represent the probabilistic nature of them. To this end, a large number of scenarios is generated by the MCS technique. In the first step of this method, the Normal Probability Distribution Function (PDF) for the error of each parameter is constructed by exploiting historical data. Then, according to the established PDFs, the value of the forecasted parameter, and Equation (1) the desired number of scenarios is created [29].
x t,s = x For. t +x Err. t,s , ∀t, s Based on the above expression, for each stochastic factor, scenario x t,s is obtained from the summation of its forecasted value, x For. t , and a positive or negative error, x Err. t,s . It is noteworthy that x Err. t,s is extracted from the PDF of errors using random numbers. Afterwards, the scenario tree is used to combine the discrete outcome of random variables and form the integrated set of scenarios. The constructed tree comprises stages and nodes where each stage displays the time step of the problem, whereas each node expresses the state of parameters at a specific time interval. In this tree, paths among nodes are defined as intended scenarios [30]. Nonetheless, since solving the problem with a variety of scenarios results in the complexity of the model and a computational burden, the generated scenarios should be reduced to an adequate number by implementing a proper scenario reduction algorithm. According to these explanations, in this work, the combination of a fast backward/forward algorithm in the SCENRED2 tool of the GAMS software [31] is used to diminish the initial number of scenarios to 10. The reduction algorithm tries to retain a set of probable scenarios by minimizing the Kantorovich distance between the primary set of scenarios and the reduced ones [32]. The probabilities of the reduced scenarios are reported in Table 2.

Problem Formulation
Based on the explanations of the previous section, in the following, each player's objective function and its related constraints are formulated mathematically.

Objective Function and Constraints of the Leader: DSO
The DSO, as the operator of the SDN, procures electricity from both wholesale and local markets simultaneously. Therefore, the objective function of this level is to minimize the expected cost of the DSO, which consists of the market transaction as well as operating costs using two-stage stochastic programming. Accordingly, the exchanged energy in the DA WEM and the DA LEM, as well as the output power of dispatchable units, are here-and-now variables, whereas the exchanged energy in both RT markets and the power adjustment of the local resources are wait-and-see decisions.
Generally, the DSO supplies most of the customers' demand from both WEM and LEM. However, this entity is able to provide some demand requirements from its local units as well. Hence, the objective function of the DSO comprises three main parts, involvement in the WEM, involvement in the LEM, and operating costs of local resources. These three parts are valid for the DA and RT stages.

O.F upper-level = Min
The first, second, and third lines of Equation (2) are related to the first stage of the problem. The first and second terms are the costs of exchanged energy in the DA WEM and the DA LEM, respectively. The third term is the generation, start-up, and shut-down costs of dispatchable units. The rest of the lines are associated with the second stage of the problem. The first two terms are the costs of exchanged energy in the RT WEM as well as the RT LEM, respectively. The last term is the upward/downward power adjustment costs of dispatchable resources. As it is clear in Equation (2), it is assumed that the RT markets are cleared every hour [33].
subject to: 1. AC power flow constraints: In this study, an AC power flow is applied to the SDN, in which the voltage magnitudes, current flows, and active powers are decision variables. According to the depicted branch in Figure 2, the technical constraints of a distribution network are modeled as follows [18]: Energies 2020, 13, 3621 P loss Energies 2020, 13, x FOR PEER REVIEW 8 of 33 Equations (3) and (4) model the injected power from buses α and β to the line, respectively.
Equations (5) and (6) calculate the active power flows and power losses, respectively. Equations (7) and (8)  Equations (3) and (4) model the injected power from buses α and β to the line, respectively. Equations (5) and (6) calculate the active power flows and power losses, respectively. Equations (7) and (8) express the amount of current flow and its limitation. Finally, Equation (9) limits the amount of voltage fluctuation. As it is clear, Equations (5) and (6) contain non-linear terms, namely I 2 αβ (t, s) and V 2 α (t, s), that are linearized by the piecewise linearization method, as described in [34]. It should be noted that the same set of expressions are valid for the RT as well.
2. Power balance constraints: In general, the exchanged power of the DSO with both markets and its local production should satisfy the demand. Accordingly, the DA power balance of the DSO at the slack bus and other buses in each period of time are formulated in Equations (12) and (13), respectively. In Equation (12), index α = 1 refers to the substation node, which is the interface between the transmission and the distribution systems and, therefore, the link with the WEM. It is notable that, since the AG trades energy with the WEM through the SDN platform and the slack bus, the purchased and sold powers of the AG are also considered in the power balance of the DSO.
On the other hand, after the realization of uncertain variables, the DSO has to compensate for its shortage or supply its excess energy by participating in the RT markets. As a result, the RT power balance of the DSO at the slack bus and other buses in each period of time and each scenario can be expressed by Equations (14) and (15)  = β:(α,β)∈Λ 0.5 P flow αβ (t, s) + P loss αβ (t, s) − P flow αβ (t) − P loss αβ (t) , ∀α 1, t, s 3. Constraints of the exchanged power with the markets: Purchased/sold power from/to available markets are non-negative variables that are limited by the power balance and operational constraints of the network. Moreover, in order to prevent arbitrage opportunity between the WEM and LEM, the sold and purchased power of the DSO in both stages cannot occur at the same time. Hence, Equations (16) and (17) are provided to restrict the DSO from simultaneous selling and buying of energy. Without these limitations, the DSO, as the leader of the game, makes the AG purchase energy from the WEM at a high price and sell it to the LEM at a low price. Thus, the AG is harmed significantly by this.
Nevertheless, since the above constraints are non-linear, they are linearized by using the Big-M method [35], as shown in Equations (18) and (21).
4. Non-dispatchable resources constraints: Based on the wind speed forecast as well as solar irradiance forecast at each period of time, the produced power of the WT and PV can be determined as follows [36]: The same expressions are valid for the various generated scenarios as well. It is noteworthy that the above expressions are part of the data preprocessing, where the values of wind speed, solar irradiation, and temperature are converted into power values; hence, they act as input parameters of the optimization problem.

Dispatchable resources constraints:
The generation capacity and the upward/downward reserve capacity of the DSO's local dispatchable units are limited by Equations (24) and (25) [37].
Moreover, the linear model for minimum up/down-time constraints of these resources is stated in the following equations [38].
Equations (26) and (28) are associated with the minimum up-time, in which when the state of the unit changes from "off" to "on", and that unit must be "on" for the minimum up time (MUT) duration. In contrast, Equations (27) and (29) are related to the minimum down-time, in which when the state of the unit changes from "on" to "off", and that unit must be "off" for the minimum down time (MDT) duration. Finally, the start-up and shut-down costs of the resources are formulated in Equations (30) and (31).

Objective Function and Constraints of the Follower: DER Aggregator
In the SDN, numerous decentralized DERs cooperate with one another in order to participate in the WEM and LEM effectively. For this purpose, these resources form a coalition and define a virtual operator, namely the DER AG, for their coalition. This platform aids owners of these units to obtain more profit since they do not have to sign a take-or-pay contract at a lower price than the market price [39]. Based on the presented issues, the objective function of this level is to maximize the expected profit of the AG by taking part in the available markets through two-stage stochastic programming. Similar to the DSO, the traded energy of the AG in the DA WEM and the DA LEM, as well as the output power of dispatchable sources, are here-and-now decisions, while the traded energy in both RT markets is a wait-and-see variable.
Since the objective function of the AG is the maximization of the benefit, it is defined as the difference between the incomes and expenses of this entity. The AG's revenue includes the price of the energy sold to the existing markets, whereas its expenses include the price of the energy bought from both markets as well as the operating costs of DERs.
− J j P jdis,AG (j, t) · HR · λ Gas + OM exp . − J j P jch,AG (j, t) · OM com. + S s ρ(s) P RT,WEM sell,AG (t, s) − P RT,WEM buy,AG (t, s) · λ RT,WEM (t, s) The first, second, third, and fourth lines of Equation (32) are related to the first stage of the problem. The first and second terms are the costs of exchanged energy in the DA WEM and DA LEM, respectively. The third term is the marginal generation cost of dispatchable units. The fourth term is the operating cost of the CAES systems. The last two lines are associated with the second stage of the problem that illustrates the costs of exchanged energy in the RT WEM and the RT LEM, respectively. subject to: 1. Power balance constraints: Clearly, the exchanged power of the AG in both existing markets must be equal to its generation and consumption. Thus, the DA power balance of this autonomous agent in each period of time can be represented by Equation (33). It should be noted that P DA,LEM buy (t) is the purchased power of the DSO from the AG in the DA LEM; hence this parameter acts as sold power of the AG in this market. The same concept is valid for P DA,LEM sell (t) as well. On the contrary, after learning the stochastic parameters, the AG is able to compensate for its shortage or supply its surplus energy by taking part in the RT markets. This matter is illustrated in Equation (34).
Similarly, P RT,LEM buy (t, s) is the purchased power of the DSO from the AG in the RT LEM; hence this parameter acts as sold power of the AG in this market. The same concept is valid for P RT,LEM sell (t, s) as well.
2. Constraints of the exchanged power with the markets: Similar to the leader, in order to avoid arbitrage opportunity between markets, the sold and purchased power of the follower in both stages cannot take place at the same time as well. Consequently, Equations (35) and (36) are used to limit the AG from simultaneous selling and buying of energy.
However, inasmuch as these constraints are non-linear, they should be linearized, as displayed in the following expressions.
3. Non-dispatchable resources constraints: Equations (41) and (42) are provided to formulate the forecasted power of the AG's WT and PV.
These equations are also used to calculate the output power of these units in different scenarios.

Dispatchable resources constraints:
The output power of the AG's dispatchable units is limited by Equation (43).
Energies 2020, 13, 3621 13 of 32 Additionally, the operational constraints of these sources can be modeled as follows [40]: Equations (44) and (45) limit the maximum increase and decrease in the power of dispatchable resources at each time interval, respectively. Furthermore, owing to the fact that, normally, the majority of the generated energy is traded in the DA markets, it is assumed that the offers of the AG's generation units are only presented in the DA WEM as well as the DA LEM.

Compressed Air Energy Storage systems constraints:
The mathematical model and technical requirements of the AG's CAES systems are presented in Equations (46) and (51). In this regard, the injected power as well as the produced power of the CAES are limited by Equations (46) and (47) [41]. P min jch,AG ≤ P jch,AG (j, t) ≤ P max jch,AG , ∀j, t µ 9 (j, t), µ 10 (j, t) (46) P min jdis,AG ≤ P jdis,AG (j, t) ≤ P max jdis,AG , ∀j, t µ 11 (j, t), µ 12 (j, t) The amount of stored energy in the system and its related limitations are expressed in the following equations: Accordingly, the initial amount of stored energy at the beginning of the first-time interval, as well as the final amount of stored energy at the end of the last time interval, are modeled by Equations (48) and (50), respectively. Additionally, the variation of stored energy and its limitation at each time interval are formulated by Equations (49) and (51), respectively. Similar to dispatchable units of the DER AG, bids and offers of the CAES systems are assumed to be provided only in the DA markets.

Bi-Level Programming Outline
In conclusion, to better clarify the provided leader-follower model, linking and non-linking variables of existing players are depicted in Figure 3. As it is shown in this figure, the DSO submits P DA,LEM sell , P RT,LEM sell and P DA,LEM buy , P RT,LEM buy as its offers and bids to the DER AG. Based on these proposals that act as parameters, the AG decides on P DA,WEM sell,AG , P RT,WEM sell,AG , P DA,WEM buy,AG , P RT,WEM buy,AG , P i,AG , P jdis,AG , P jch,AG . Then, these decision variables are sent back to the leader as the reaction of the follower to optimize the objective function of the DSO and to evaluate its expected operating costs. It should be emphasized that since the variables of the follower, namely P DA,WEM sell,AG , P RT,WEM sell,AG , P DA,WEM buy,AG , P RT,WEM buy,AG , P i,AG , P jdis,AG , P jch,AG are directly present in the power balance expressions of the leader, i.e., Equations (12) and (15), the proposed framework can be considered as a bi-level leader-follower problem. Energies 2020, 13, x FOR PEER REVIEW 14 of 33

Reformulation of the Proposed Model to a Single Level
One of the most prevailing techniques to solve leader-follower game-theoretic problems is the Karush-Kuhn-Tucker (KKT) formulation. Generally, if the problem of the follower is linear and continuous, the global optimality can be guaranteed by using this method [42]. On the other hand, owing to the presence of complementary constraints, a non-linear single-level problem is produced from KKT conditions. In this study, to linearize the non-linear problem with these kinds of limitations, the Big-M approach is suggested. The general mathematical formulation of the mentioned framework was described in more detail in [43]. According to the aforementioned explanations, the single-level model of the considered problem is formulated as follows: In the above equation, Ξ is a set for decision variables of the single-level problem that includes:

Reformulation of the Proposed Model to a Single Level
One of the most prevailing techniques to solve leader-follower game-theoretic problems is the Karush-Kuhn-Tucker (KKT) formulation. Generally, if the problem of the follower is linear and continuous, the global optimality can be guaranteed by using this method [42]. On the other hand, owing to the presence of complementary constraints, a non-linear single-level problem is produced from KKT conditions. In this study, to linearize the non-linear problem with these kinds of limitations, the Big-M approach is suggested. The general mathematical formulation of the mentioned framework was described in more detail in [43]. According to the aforementioned explanations, the single-level model of the considered problem is formulated as follows: buy,DSO (t) − P DA,WEM sell,DSO (t) · λ DA,WEM (t) 3. Stationary constraints: 4. Primal inequality, complementary, and dual constraints: 0 ≤ P jdis,AG (j, t) − P min jdis,AG 0 ≤ P max jdis,AG − P jdis,AG (j, t) ⊥ µ 12 (j, t) ≥ 0,

Linearization of complementary constraints:
Complementary constraints in Equations (62)-(75) are linearized by using the following expression, in which M is a large value, and X is a binary variable.

Numerical Results and Discussion
In this section, the proposed methodology is examined and validated in two case studies. In this regard, first, the studied system and its input data are introduced. Afterwards, analyses of the simulation results are discussed thoroughly.

Input Data
A modified IEEE 33-Bus SDN was selected in order to test the provided framework. Figure 4 illustrates the one-line diagram of the distribution system. As it is shown in this figure, the SDN has three types of loads: Commercial (C), Industrial (I), and Residential (R). λ t , λ t,s , λ j,t , λ j,t , λ j,t Unrestricted,

Linearization of complementary constraints:
Complementary constraints in Equations (62)-(75) are linearized by using the following expression, in which M is a large value, and X is a binary variable.

Numerical Results and Discussion
In this section, the proposed methodology is examined and validated in two case studies. In this regard, first, the studied system and its input data are introduced. Afterwards, analyses of the simulation results are discussed thoroughly.

Input Data
A modified IEEE 33-Bus SDN was selected in order to test the provided framework. Figure 4 illustrates the one-line diagram of the distribution system. As it is shown in this figure, the SDN has three types of loads: Commercial (C), Industrial (I), and Residential (R). The forecasted load profiles of the network in the p.u. (per-unit) form are displayed in Figure 5. In addition, the peak demand of each load is reported in Table 3. The forecasted load profiles of the network in the p.u. (per-unit) form are displayed in Figure 5. In addition, the peak demand of each load is reported in Table 3.
As it is observed, the forecasted demand of each bus during the day is obtained by multiplying its peak demand by the p.u. load profiles. Additionally, based on the explained methods as for the scenario generation and reduction, 10 profiles are obtained for each type of load. By multiplying these profiles by the peak demands, the RT load demands are modeled.
According to Figure 4, the DSO has three kinds of local resources at buses 10, 25, and 33. In contrast, the AG's decentralized DERs are located at buses 2, 4, 18, 22, and 28. The input data and characteristics of these units are summarized in Tables 4-6. Additionally, the temperature profile of the studied area was taken from [44].  As it is observed, the forecasted demand of each bus during the day is obtained by multiplying its peak demand by the p.u. load profiles. Additionally, based on the explained methods as for the scenario generation and reduction, 10 profiles are obtained for each type of load. By multiplying these profiles by the peak demands, the RT load demands are modeled.
According to Figure 4, the DSO has three kinds of local resources at buses 10, 25, and 33. In contrast, the AG's decentralized DERs are located at buses 2, 4, 18, 22, and 28. The input data and characteristics of these units are summarized in Tables 4-6. Additionally, the temperature profile of the studied area was taken from [44].   Table 5. Input data of non-dispatchable units.   Table 4. Input data of dispatchable units.  Table 5. Input data of non-dispatchable units.  Moreover, the wind speed and solar irradiance forecast during a typical day are shown in Figure 6. Similar to the demand, for the uncertainty modeling of wind speed and solar radiation in the RT, 10 different scenarios are used based on the aforementioned procedures.  Moreover, the wind speed and solar irradiance forecast during a typical day are shown in Figure  6. Similar to the demand, for the uncertainty modeling of wind speed and solar radiation in the RT, 10 different scenarios are used based on the aforementioned procedures. Furthermore, the DA market prices were predicted based on Figure 7. Note that the price of the LEM in the early hours of the day is lower than the price of the WEM. This issue ensues from the existence of the solar-based production at these hours. By considering the forecasted values as well as the normal PDF of errors, 10 reduced scenarios are used for the uncertainty modeling of the RT market prices. For instance, the RT WEM prices are shown in Figure 8. Furthermore, the DA market prices were predicted based on Figure 7. Note that the price of the LEM in the early hours of the day is lower than the price of the WEM. This issue ensues from the existence of the solar-based production at these hours. By considering the forecasted values as well as the normal PDF of errors, 10 reduced scenarios are used for the uncertainty modeling of the RT market prices. For instance, the RT WEM prices are shown in Figure 8.

Analysis of Simulation Results
To examine the effectiveness of the suggested algorithm, two case studies are implemented, and their outputs are compared with one another. The considered model stated by Equations (52)-(77) is a mixed-integer linear programming problem, which is solved by the CPLEX solver in the General Algebraic Modeling System software. The optimality gap of the optimization model is set to 0.0, and the running time of it is less than 100 s. The personal computer used for simulation has an Intel Core i7-4510U CPU (2.60-GHz) and 8 GB of RAM.

Case Study 1: Considering the Game-Theoretic Approach
In this case, existing players of the SDN are able to optimize their objective functions independently through the proposed Stackelberg game-based framework. The exchanged energy of the DSO with available markets in the DA stage is displayed in Figure 9.

Analysis of Simulation Results
To examine the effectiveness of the suggested algorithm, two case studies are implemented, and their outputs are compared with one another. The considered model stated by Equations (52)-(77) is a mixed-integer linear programming problem, which is solved by the CPLEX solver in the General Algebraic Modeling System software. The optimality gap of the optimization model is set to 0.0, and the running time of it is less than 100 s. The personal computer used for simulation has an Intel Core i7-4510U CPU (2.60-GHz) and 8 GB of RAM.

Case Study 1: Considering the Game-Theoretic Approach
In this case, existing players of the SDN are able to optimize their objective functions independently through the proposed Stackelberg game-based framework. The exchanged energy of the DSO with available markets in the DA stage is displayed in Figure 9. To better investigate the pattern of energy exchange, forecasted prices of markets are illustrated in the above figure. Clearly, the DSO procures its required energy from the LEM when the price of this market is lower than the price of the WEM. Furthermore, in the here-and-now stage, the DSO is not inclined to sell its energy to both markets. On the other hand, the optimal operating points of the DSO's non-dispatchable as well as dispatchable local resources are shown in Figure 10. According to this figure, the DSO's dispatchable units were exploited at their minimum capacities in the early hours of the day, so that the DSO is able to utilize the reserve capacity of these sources in the RT stage. However, during hours 20 to 23, the simultaneous peak of the DA market prices and demand makes the DSO use its own dispatchable units at their maximum capacities. To better investigate the pattern of energy exchange, forecasted prices of markets are illustrated in the above figure. Clearly, the DSO procures its required energy from the LEM when the price of this market is lower than the price of the WEM. Furthermore, in the here-and-now stage, the DSO is not inclined to sell its energy to both markets. On the other hand, the optimal operating points of the DSO's non-dispatchable as well as dispatchable local resources are shown in Figure 10. According Energies 2020, 13, 3621 20 of 32 to this figure, the DSO's dispatchable units were exploited at their minimum capacities in the early hours of the day, so that the DSO is able to utilize the reserve capacity of these sources in the RT stage. However, during hours 20 to 23, the simultaneous peak of the DA market prices and demand makes the DSO use its own dispatchable units at their maximum capacities.
considering the competitive environment.
To better investigate the pattern of energy exchange, forecasted prices of markets are illustrated in the above figure. Clearly, the DSO procures its required energy from the LEM when the price of this market is lower than the price of the WEM. Furthermore, in the here-and-now stage, the DSO is not inclined to sell its energy to both markets. On the other hand, the optimal operating points of the DSO's non-dispatchable as well as dispatchable local resources are shown in Figure 10. According to this figure, the DSO's dispatchable units were exploited at their minimum capacities in the early hours of the day, so that the DSO is able to utilize the reserve capacity of these sources in the RT stage. However, during hours 20 to 23, the simultaneous peak of the DA market prices and demand makes the DSO use its own dispatchable units at their maximum capacities. On the contrary, the optimal participation of the DER AG in the WEM and LEM is shown in Figure 11. On the contrary, the optimal participation of the DER AG in the WEM and LEM is shown in Figure 11. Based on the above figure, when the price of the LEM is lower than the price of the WEM, the DSO makes the AG sell its produced power to the local market. In addition, since the WEM's price is slightly lower than the LEM's price at hour 7, the DER AG has purchased nearly 1.4 MWh from the WEM in order to charge its local CAES system. It is noteworthy that insofar as the considered local TE market consists of only two participants, the amount of sold energy by the AG at a specific hour is equal to the amount of purchased energy by the DSO. Additionally, Figure 12 depicts the optimal operating points of the AG's dispatchable as well as renewable-based resources. As it is shown, the DER AG not only sells its generated energy to the DA markets, but also utilizes this energy for its consumption. For instance, at hour 7, the AG bought only 1.4 MWh from the WEM to charge the CAES unit, hence, the rest of the required energy for charging, approximately 2.6 MWh, was provided by local renewable resources. Based on the above figure, when the price of the LEM is lower than the price of the WEM, the DSO makes the AG sell its produced power to the local market. In addition, since the WEM's price is slightly lower than the LEM's price at hour 7, the DER AG has purchased nearly 1.4 MWh from the WEM in order to charge its local CAES system. It is noteworthy that insofar as the considered local TE market consists of only two participants, the amount of sold energy by the AG at a specific hour is equal to the amount of purchased energy by the DSO. Additionally, Figure 12 depicts the optimal operating points of the AG's dispatchable as well as renewable-based resources. As it is shown, the DER AG not only sells its generated energy to the DA markets, but also utilizes this energy for its consumption. For instance, at hour 7, the AG bought only 1.4 MWh from the WEM to charge the CAES unit, hence, the rest of the required energy for charging, approximately 2.6 MWh, was provided by local renewable resources.
is equal to the amount of purchased energy by the DSO. Additionally, Figure 12 depicts the optimal operating points of the AG's dispatchable as well as renewable-based resources. As it is shown, the DER AG not only sells its generated energy to the DA markets, but also utilizes this energy for its consumption. For instance, at hour 7, the AG bought only 1.4 MWh from the WEM to charge the CAES unit, hence, the rest of the required energy for charging, approximately 2.6 MWh, was provided by local renewable resources. As mentioned previously, in the wait-and-see phase, after the realization of stochastic variables, the aforementioned entities make their decisions as to the exchanged energy in the RT WEM and RT LEM. At this stage, optimum decisions are made according to generated scenarios. These scenarios represent the changes of uncertain parameters from the forecasted values. For the sake of clarity, the WT and PV power variations of the AG during a day and in the entire set of scenarios are displayed in Figure 13. As mentioned previously, in the wait-and-see phase, after the realization of stochastic variables, the aforementioned entities make their decisions as to the exchanged energy in the RT WEM and RT LEM. At this stage, optimum decisions are made according to generated scenarios. These scenarios represent the changes of uncertain parameters from the forecasted values. For the sake of clarity, the WT and PV power variations of the AG during a day and in the entire set of scenarios are displayed in Figure 13. In this step, on one hand, the DSO could compensate for its shortage or supply its excess energy by taking part in both RT markets. On the other hand, this agent is able to increase or diminish its production through the reserve capacity of dispatchable resources. To better investigate the impact of stochastic factors on the performance of the DSO, the change of demand and output power of renewable units for a sample scenario, scenario 6, is shown in Figure 14. In this step, on one hand, the DSO could compensate for its shortage or supply its excess energy by taking part in both RT markets. On the other hand, this agent is able to increase or diminish its production through the reserve capacity of dispatchable resources. To better investigate the impact of stochastic factors on the performance of the DSO, the change of demand and output power of renewable units for a sample scenario, scenario 6, is shown in Figure 14. In this step, on one hand, the DSO could compensate for its shortage or supply its excess energy by taking part in both RT markets. On the other hand, this agent is able to increase or diminish its production through the reserve capacity of dispatchable resources. To better investigate the impact of stochastic factors on the performance of the DSO, the change of demand and output power of renewable units for a sample scenario, scenario 6, is shown in Figure 14. It must be noted that, in the above figure, the increase in demand was portrayed by negative bars, whereas the increase in power generation was depicted by positive bars. Additionally, the total variation was determined by the line graph. Accordingly, if the total change is positive, the DSO should sell its excess energy to the RT markets or activate the downward reserves. In contrast, if the total change is negative, the DSO must buy the required energy from these electricity markets or activate the upward reserves. Moreover, it is possible that the DSO adjusts its reserve capacity to not only satisfy the variation but also exchange energy with available markets. Figure 15 indicates these matters in more detail. For example, at hour 4, the total variation of the DSO's stochastic parameters is equal to −3.1 MWh. As a result, the DSO needs about 3.1 MWh energy to compensate for this shortage. However, since the cost of dispatchable units for providing upward power is lower than the LEM's RT price, the DSO prefers to produce 7.1 MWh to not only provide its requirement, but to also sell 4 MWh to the RT local market. Finally, for scenario 6, changes in the DER AG's renewable resources as well as the optimal involvement of this player in the RT markets are shown in Figures  16 and 17, respectively. It must be noted that, in the above figure, the increase in demand was portrayed by negative bars, whereas the increase in power generation was depicted by positive bars. Additionally, the total variation was determined by the line graph. Accordingly, if the total change is positive, the DSO should sell its excess energy to the RT markets or activate the downward reserves. In contrast, if the total change is negative, the DSO must buy the required energy from these electricity markets or activate the upward reserves. Moreover, it is possible that the DSO adjusts its reserve capacity to not only satisfy the variation but also exchange energy with available markets. Figure 15 indicates these matters in more detail. For example, at hour 4, the total variation of the DSO's stochastic parameters is equal to −3.1 MWh. As a result, the DSO needs about 3.1 MWh energy to compensate for this shortage. However, since the cost of dispatchable units for providing upward power is lower than the LEM's RT price, the DSO prefers to produce 7.1 MWh to not only provide its requirement, but to also sell 4 MWh to the RT local market. Finally, for scenario 6, changes in the DER AG's renewable resources as well as the optimal involvement of this player in the RT markets are shown in Figures 16 and 17, respectively.
Similar to the situation of the DSO, at hour 4, the total variation of the AG's uncertain factors is equal to −4 MWh. Therefore, based on Figure 17, the AG bought 4 MWh from the LEM to compensate for the lack of energy. In this regard, it is worth noting that since the local TE market includes just two participants, the sold power by the DSO at this hour was purchased by the AG.       In the remainder of this section, to evaluate the total cost of the DSO during the day and also to determine the role of each market and each scenario in this operating cost, the revenue distribution and cost distribution of this player in the DA and RT markets are presented in detail in Table 7. In addition to costs, in this table, the sold/purchased powers of the DSO to/from available markets during the 24-h period are expressed as well. Based on the above table, the minimum operating cost of the DSO during the studied day is equal to 45,143.2 USD, which is calculated by adding up all costs (first, second, and last columns) subtracting all incomes (fifth and sixth columns). Note that, to calculate the cost or income in each scenario, the scenario's probability of occurrence was taken into account as well. Furthermore, in this study, the operating cost of non-dispatchable resources was neglected, hence the last column of the table is only related to the operating cost of dispatchable units.
The same study can also be executed for the DER AG. In this regard, the revenue distribution, cost distribution, and exchanged energy of this entity in two stages of the LEM and WEM are summarized in Table 8. The last column of the mentioned table reflects the total operating cost of the AG's dispatchable units as well as the CAES system. Based on the provided figures, the maximum benefit of the DER AG during the studied day is equal to 10,149.7 USD, which is calculated by adding up all of the incomes (fifth and sixth columns) and subtracting all of the costs (first, second and last columns). At the end of this section, the DSO's total costs as well as the AG's total profits that result from taking part in local and wholesale markets are reported in Table 9. By considering the operating cost of DERs, the last row of this table indicates the DSO's daily operating cost and the AG's daily benefit.
Accordingly, it is assumed that a benevolent planner attempts to optimize the objectives of entities and redistribute costs or incomes among them. This perspective is merely raised to validate the obtained results from the previous case study. This is because, based on the competition between actors as well as the privatization of ownership, the only practical solution for solving the considered problem is the game-based model. In the following figure, the optimal participation of the DSO in the DA LEM and the DA WEM is presented. According to Figure 18, in the peak hours, due to the high amount of electricity demand and the DA market prices, the DSO purchased more power from the AG and limited its trades with the WEM. Additionally, unlike the previous case study, in this condition, the DSO has more of a tendency to exchange energy with the AG in the LEM platform.
Accordingly, it is assumed that a benevolent planner attempts to optimize the objectives of entities and redistribute costs or incomes among them. This perspective is merely raised to validate the obtained results from the previous case study. This is because, based on the competition between actors as well as the privatization of ownership, the only practical solution for solving the considered problem is the game-based model. In the following figure, the optimal participation of the DSO in the DA LEM and the DA WEM is presented.
According to Figure 18, in the peak hours, due to the high amount of electricity demand and the DA market prices, the DSO purchased more power from the AG and limited its trades with the WEM. Additionally, unlike the previous case study, in this condition, the DSO has more of a tendency to exchange energy with the AG in the LEM platform. On the other hand, the optimal involvement of the AG in the DA markets is portrayed in Figure 19. As expected, except for hours 1 to 3, the AG sold the entire produced energy to the DSO. On the other hand, the optimal involvement of the AG in the DA markets is portrayed in Figure  19. As expected, except for hours 1 to 3, the AG sold the entire produced energy to the DSO. The DSO and AG's traded energy in the RT markets for a sample scenario, scenario 6, is investigated in this section also. Figures 20 and 21 illustrate the pattern of the exchanged power in more detail. As shown in Figure 20, the DSO traded energy in the RT WEM and has no power exchange in the RT LEM. As a result of this fact, the AG only participated in the RT WEM to adjust the power variation of its local non-dispatchable units. The DSO and AG's traded energy in the RT markets for a sample scenario, scenario 6, is investigated in this section also. Figures 20 and 21 illustrate the pattern of the exchanged power in more detail. As shown in Figure 20, the DSO traded energy in the RT WEM and has no power exchange in the RT LEM. As a result of this fact, the AG only participated in the RT WEM to adjust the power variation of its local non-dispatchable units. The DSO and AG's traded energy in the RT markets for a sample scenario, scenario 6, is investigated in this section also. Figures 20 and 21 illustrate the pattern of the exchanged power in more detail. As shown in Figure 20, the DSO traded energy in the RT WEM and has no power exchange in the RT LEM. As a result of this fact, the AG only participated in the RT WEM to adjust the power variation of its local non-dispatchable units. Moreover, the DSO's daily cost distribution as well as the DER AG's daily profit distribution are summarized in Table 10. Ultimately, the obtained results from these two case studies are compared with one another in Table 11. According to Table 11, without utilizing the game-based method, the operating cost of the DSO increased about 549.3 USD. On the contrary, the profit of the AG increased by about 1230 USD. Indeed, in the Stackelberg game-based framework, since the DSO was considered as the leader of the problem, it was able to profit from a better situation and reduce its total operating costs. In contrast, since the AG was considered as the follower of this game, it obtained less profit than in the second Moreover, the DSO's daily cost distribution as well as the DER AG's daily profit distribution are summarized in Table 10. Table 10.
Cost and benefit distribution of market participants without considering the competitive environment. Ultimately, the obtained results from these two case studies are compared with one another in Table 11. According to Table 11, without utilizing the game-based method, the operating cost of the DSO increased about 549.3 USD. On the contrary, the profit of the AG increased by about 1230 USD. Indeed, in the Stackelberg game-based framework, since the DSO was considered as the leader of the problem, it was able to profit from a better situation and reduce its total operating costs. In contrast, since the AG was considered as the follower of this game, it obtained less profit than in the second case study. From the above table, the DER AG would prefer to obtain more profit from trading energy in the LEM. However, since the AG is an independent private player in the LEM, energy trading in this market has to be executed based on a game-theoretic method. In other words, the AG, as a follower, should accept the reduction of its benefit and set its decisions according to decisions of the DSO, as the leader of the problem and the owner of the SDN.

Conclusions
Nowadays, the penetration of numerous DERs with private ownership has led to a variety of challenges in the optimal scheduling of SDNs. The reason for this is that, on one hand, the separate participation of each small-scale DER in the energy management program of the DSO could not be optimal. On the other hand, satisfying the inherent conflicts that exist between the interests of each private unit and the DSO is highly difficult and may lead to intractability. As a result, presenting a proper framework in which a wide range of DERs can cooperate with one another to not only meet the SDN's operational constraints but also promote their own benefit is essential. Based on these matters, in this article, an AG was defined to integrate DERs at the distribution level and interact with the DSO in a LEM platform. For solving this problem and modeling the TE environment among entities, a Stackelberg game-based method was presented in which the DSO and the DER AG are able to participate simultaneously in the LEM and WEM. Hence, at the upper level of this game, the operating cost of the DSO was minimized, while at the lower level, the expected profit of the AG was maximized. In order to deal with various uncertainties that exist in the decision-making process of both autonomous agents, a scenario-based two-stage stochastic programming method was used. The efficiency of the proposed scheme for the solving of the mentioned problem was tested in two case studies, with and without considering the competitive environment among players. The simulation results confirmed that due to the presence of private participants in the SDN, the energy exchange between actors in the LEM platform must be modeled based on the game-theoretic approach. In the end, for future works, the proposed model has the capability to be expanded by considering more than one AG of different types, such as Demand Response AG and Electric Vehicle AG in a LEM.