Impact Factor 4.008 | CiteScore 2.6
More on impact ›


Front. Energy Res., 04 November 2021 |

Local Electricity Markets for Electric Vehicles: An Application Study Using a Decentralized Iterative Approach

  • 1GECAD Research Group on Intelligent Engineering and Computing for Advanced Innovation and Development (GECAD), Polytechnic of Porto, Porto, Portugal
  • 2Department of Electrical Engineering, Chalmers University of Technology, Göteborg, Sweden
  • 3Departamento de Engenharia Elétrica, Faculdade de Engenharia de Ilha Solteira, UNESP–Universidade Estadual Paulista, Ilha Solteira, Brazil
  • 4School of Engineering (ISEP), Polytechnic of Porto, Porto, Portugal

Local electricity markets are emerging solutions to enable local energy trade for the end users and provide grid support services when required. Various models of local electricity markets (LEMs) have been proposed in the literature. The peer-to-peer market model appears as a promising structure among the proposed models. The peer-to-peer market structure enables electricity transactions between the players in a local energy system at a lower cost. It promotes the production from the small low–carbon generation technologies. Energy communities can be the ideal place to implement local electricity markets as they are designed to allow for larger growth of renewable energy and electric vehicles, while benefiting from local transactions. In this context, a LEM model is proposed considering an energy community with high penetration of electric vehicles in which prosumer-to-vehicle (P2V) transactions are possible. Each member of the energy community can buy electricity from the retailer or other members and sell electricity. The problem is modeled as a mixed-integer linear programing (MILP) formulation and solved within a decentralized and iterative process. The decentralized implementation provides acceptable solutions with a reasonable execution time, while the centralized implementation usually gives an optimal solution at the expense of reduced scalability. Preliminary results indicate that there are advantages for EVs as participants of the LEM, and the proposed implementation ensures an optimal solution in an acceptable execution time. Moreover, P2V transactions benefit the local distribution grid and the energy community.


Despite the pandemic that largely affected the automotive industry in 2020, the electric vehicle (EV) and renewable energy industry performed remarkably well (Lieven 2021; Wan et al., 2021). In fact, EV sale numbers in Europe increased to record numbers and all-time highs (up 137% from 2019), while the overall automotive industry was down by 20% year on year (Irle 2021). Most oil energy companies quickly shifted investments toward renewable energy projects and became more ESG1-oriented, anticipating an earlier oil use peak (Strauch et al., 2020). The quicker energy transition motivated by the pandemic, the need to foster job creation, and new opportunities in the industry flag the importance to accelerate the conditions to accommodate a large penetration of EVs (Barbier 2020).

Most researchers agree that a large number of EVs in the grid will bring new operational challenges but also new opportunities (Fotouhi Ghazvini et al., 2019; Chung et al., 2019; Das et al., 2020). Challenges may include distribution lines and transformers’ capacity limitations, overheating and overvoltage issues, bidirectional power flows (vehicle-to-grid), and market price increases (Gesevičius et al., 2021). Opportunities will include new business models, no-upfront cost grid services, improved renewable energy use, etc.

In this context, local electricity markets (LEMs) have been proposed as an effective tool to mitigate some bottlenecks of renewable and EV penetration in local distribution grids. Local markets are emerging in order to facilitate energy transactions among small producers and consumers in nearby energy communities (Mengelkamp et al., 2017). Their emergence is not targeting the replacement of wholesale markets and the retailing activity, but rather coexistence (Lezama et al., 2019a). Aggregators can participate in a LEM via load and EV aggregation as well (Lezama et al., 2019b; Masood et al., 2020). Among the different LEM models that have been proposed in the literature, the peer-to-peer (P2P) market model appears as a promising structure to reduce costs (Z. Zhang et al., 2020; Faia et al., 2021a).

A previous work proposed a centralized model to solve the optimal energy trading in a LEM between prosumers and EVs (Faia et al., 2021b). However, the scalability of the adopted centralized model is not enough, and the data privacy can be easily compromised. We believe that decentralized models can be a viable alternative to overcome issues previously raised, given the reduced number of resources involved in energy communities compared to region-wide scale problems. Therefore, a decentralized iterative approach is proposed in this study to solve energy management problems, considering the possibility of transactions in a prosumer-to-vehicle (P2V) market, thus enabling the prosumers to sell the surplus electricity production and to charge the EVs at a lower price than the retail market price. The price of electricity in the P2V market is assumed to be the most advantageous for both parties. The proposed model provides the integration of RESs and the empowerment of electricity end users in the power system, namely, by allowing prosumers and EVs to interact within the P2V market. The case study considers 90 players, composed of 50 domestic prosumers and 40 EVs; three different models of domestic battery systems; and seven different models of EVs. Real electricity tariffs from a Portuguese retailer and current feed-in tariff in the country are used in the case study. The main contributions of the study are as follows:

• A decentralized and iterative process is developed to determine electricity transactions among prosumers and EVs in a P2V market.

• Considering the reduction of the feed-in tariff, the proposed approach allows prosumers to have another option to sell electricity at higher price.

• Development of optimization models (prosumers and EVs) that include realistic constraints, prosumers load and generation profiles, photovoltaic (PV) systems, energy storage systems, and real and updated EV models.

The article is structured in six sections including this introductory section. A literature review is given in Literature Review. Proposed Methodology presents the proposed methodology, namely, formulation and the coordinator decision process. Case Study presents the details of the case study. Finally, Results presents the results and its discussion, while Conclusion and Future Works provides the conclusions of the article.

Literature Review

Different designs of the LEMs and the market analysis of the proposed models have been presented in the literature. Absorbing the output of local generation from renewable sources by the flexible demand has been widely investigated. A P2P local electricity market model is developed in Z. Zhang et al.’s (2020) study which considers local energy trading and the uncertainty of the demand and PV generation. In this model, the load flexibility is characterized by time and power flexibility. The results reveal that this model could be used to enable the local balancing of the PV forecast power and the uncertain demand, while both consumers and PV owners could benefit from the local P2P market.

The P2P energy trading mechanism has also been used to coordinate the distributed energy generation and consumption (Matamoros et al., 2016) and the trading among the peers in a distribution network. C. Zhang et al., (2018) proposed an innovative platform for P2P energy trading using the game theory. The test results in a microgrid show that P2P trading can improve the local balance of consumption and generation. This trading mechanism can promote increased penetration of renewable energy sources in the grid.

A local electricity market model is developed in Sæther et al. (2021) to enable P2P electricity trading for a community of industrial buildings. The impact of local flexibility on the usage of DER technologies was investigated in that work; moreover, the contribution of the local market to peak demand management was assessed. The authors showed that the local market approach leads to more local usage of the distributed resources, eliminating the need to curtail DER power and reducing the grid feed-in.

A contract-based framework to enable local energy trading for electricity suppliers in different categories (i.e., small, medium, and large suppliers) is developed in Oprea and Bâra (2021). The model helps the suppliers obtain optimal contracts and trade the surplus power with an aggregator in a hierarchical electricity trading system. The distributed algorithm for electricity trading guarantees the optimal utility of both parties in various trading scenarios.

A day-ahead local energy market model is developed in Elbatawy and Morsi (2021) in which the residential consumers with home battery storage are the main participants. It uses the utility’s distributed energy management system and the home energy management system based on the existing intercommunication system. Moreover, the provision of grid services, such as voltage support, transformer management, and phase balancing, as a result of this transactive market model, is investigated. The results show that the proposed market can contribute to grid services, while increasing the profits of the residential consumers.

Different auction mechanisms for the trade of electricity in a local market using blockchain mechanisms were investigated by Oprea and Bâra (2021). Suitable auction mechanisms for blockchain are proposed along with an adjustment of the price for both sellers and buyers after the initial clearing of the market at the classical auction levels. The simulation results show that this approach could improve the trading performance indicators.

The impact of local electricity trade on the operation of the distribution network is investigated in Lüth et al. (2020). It is concluded that exempting local trade and self-consumption from taxes could create distributional effects. That work proposes a novel market design that requires few legal amendments on the ownership and participation of renewable technologies to avoid the distributional effects of local markets, making them more attractive for the prosumers and consumers.

The work of Mustafa, Cleemput, and Abidin (Mustafa et al., 2016) provides security analysis for a proposed model of a local electricity market considering the privacy requirements of the users. Each user in this model buys or sells electricity in the local market via the supplier, and the supplier charges the user only for the electricity supplied to them by the grid and pays to them only for the exported electricity that was not traded in the local market. In this model, the DSO will also access the imported and exported electricity by all the users per supplier for each settlement period.

The aforementioned works indicate the potential of LEMs to benefit producers and consumers in energy communities. Nevertheless, further research on decentralized models is required to overcome scalability limitations when multiple agents are involved. Thus, Proposed Methodology presented the proposed methodology based on optimization models solved in a decentralized way.

Proposed Methodology

In this section, the details of the model used to characterize the transactions among the local prosumers and EVs are presented. The optimization models for prosumers and EVs are presented first and then the iterative process proposed for ensuring the balance in the P2V market is explained. The proposed methodology constitutes two different optimization models: prosumer model and EV model. Both of them are formulated as a MILP problem with the possibility of energy exchange among the retailers, the distribution grid, and the P2V market. It is assumed that EVs are able to buy electricity from a retailer or the P2V market. The models also consider the energy management system properties, using storage systems to obtain the best options for the user. Figure 1 presents the model scheme of the implemented methodology.


FIGURE 1. Proposed model scheme.

As can be seen in Figure 1, in the implemented model, the prosumers can buy electricity from a retailer and sell to the main grid or in the P2V market; on the other hand, the EV can buy electricity from the retailer or directly from prosumers.


The formulations are presented for each of the three agents: prosumers, EVs, and the coordinator in the respective subsections.


The prosumer operation is represented by the minimization of its energy costs across a set of time periods. Each agent i belonging to the set {1,,Ni} optimizes its energy costs according to Eq. 1 and subject to Eqs 223. Decision-making is done in a decentralized way, which means that each prosumer solves its own optimization process.


where ProiCosts represents the energy costs for the prosumer, Pi,tRetailerbuy represents the electricity bought from a retailer, ToUi,t represents the time of use tariff contracted by the prosumer to the retailer, Pi,tGridsell corresponds to the electricity sold in the distribution grid, fit is the feed-in tariff, Pi,tP2Vsell represents the electricity sold in P2V market, pP2V  is the price of electricity in the P2V market, Δt represents the time adjustable parameter, FCi corresponds to the daily fix cost paid by the prosumer, and Nt corresponds to the total number of periods. Indices t and i represent the respective period and prosumer. Eq. 2 presents the power balance for prosumer agent i.

Pi,tGen+Pi,tRetailerbuy+Pi,tDch=Pt,iLoad+ Pt,iGridsell+Pi,tP2Vsell+Pi,tCh,tNt,(2)

where Pi,tGen represents the electricity generated by the prosumer, Pi,tDch represents the electricity discharged from the prosumer battery, Pt,iLoad corresponds to the load demanded by the prosumer, and Pi,tCh corresponds to the electricity charged by the prosumer battery. Eqs 35 simulate the prosumer’s transactions.


where P¯i,tBuy represents the maximum buying limit for the prosumers, Xi,tRetailerbuy corresponds to the binary variable for the buy action, P¯i,tSell represents the maximum limit for the sales actions, Xi,tGridsell is a binary variable for the sale on-grid actions, P¯i,tSell P2V represents the maximum limit for the sales on P2V market, and Xi,tP2Vsell represents the binary variable for the sales on P2V market. Eqs 6, 7 represent the prosumers’ restrictions for buying and selling electricity.


where Eq. 6 avoids simultaneous purchase from the retailer and selling to the grid. Eq. 7 also controls simultaneous purchase from the retailers and selling to the P2V market. Sells to the grid and the P2V market can occur at the same time in this model. Eqs 810 control charging and discharging decisions of the prosumers.

Pi,tChP¯i,tCh Xi,tCh,tNt,(8)

where P¯i,tCh represents the maximum limit for the prosumers charge battery, Xi,tCh represents the binary variable for the charge action, P¯i,tDchcorresponds to the maximum limit for the battery discharge of the prosumer, and Xi,tDch corresponds to the binary variable for the discharge action. Simultaneously, only one action (charge and discharge) is possible and the binary variables control these actions. Eq. 11, 12 model the state of charge of the storage unit.


where SoCi,tBat represents the state of charge of the storage unit, SoCiBatInit represents the battery unit’s initial value; efiCh and ηiDch represent the efficiency of charge and discharge of the battery unit, respectively. Equations 1323 present the limits for the optimization variables of prosumer’s operations.

0Pi,tRetailerbuyP¯i,tBuy ,tNt,(13)
0Pi,tDchP¯i,tDch ,tNt,(17)
Xi,tRetailerbuy{0,1} ,tNt,(19)

where SoC¯i,tBat and SoC¯i,tBat represent the maximum and minimum capacity of the battery unit, respectively.

Electric Vehicles

This section presents the optimization model for the EV agents, which minimizes the daily operation cost through Eq. 24.


where EVjCosts represents the costs for EV, Pj,tEVRetailerbuy corresponds to the electricity bought from a retailer, ToUj,t is the time of use tariff, Pj,tP2Vbuy represents the electricity bought in the P2V market, pP2V corresponds to the price of electricity in P2V market, FCj represents the fixed costs for EV, and Nj represents the total number of EVs. Eq. 25 represents the energy balance for the EVs.

Pj,tEVRetailerbuy+Pj,tP2Vbuy=Pj,tEVCh, tNt,(25)

where Pj,tEVCh represents the electricity charged for EV battery. Eqs 26, 27 model the energy balance in EV batteries.


where SoCj,tEVBat represents the state of charge of the EV battery, SoCjEVBatInit represents the initial state of EV battery, ηjEVCh represents the efficiency of EV charge action, and Pj,tEVMove represents the EV consumption during trips. Eqs 28, 29 limits the EV buying of electricity when they are on trip.

Pj,tEVRetailerbuy P¯j,tEVBuyAj,tEVMove,tNt,(28)
Pj,tP2Vbuy P¯j,tEVP2VBuyAj,tEVMove,tNt,(29)

where P¯j,tEVBuy  represents the maximum limit for buying electricity, Aj,tEVMove gives the indication if the EV is travelling (zero) or if is available to charge (one), and P¯j,tEVP2Buy represents the maximum limit for buying electricity in P2V market. Eqs 3033 present the maximum and minimum limits for the EV operation.

0Pj,tEVReatilerbuyP¯j,tEVBuy ,tNt,(30)
0 Pj,tP2VbuyP¯j,tEVP2VBuy,tNt,(31)

where P¯j,tEVCh  represent the maximum limit for EV maximum charge action and SoC¯j,tEVBat and SoC¯j,tEVBat represent the minimum and maximum level for the EV battery, respectively.


The coordinator is responsible for the process of ensuring the balance in the P2V market. The coordinator process is based on Eqs 34, 35 and applies four sequential rules. The first two rules limit the periods for prosumers’ sells (Eq. 36) and EV buys (Eq. 37), respectively. On the other hand, the last two rules limit the amount of buy and sell electricity in periods in which transactions are possible. Eq. 38 limits the maximum amount of electricity that each EV can buy in P2V market, and similarly, Eq. 39 imposes a limit for prosumers’ sales.

Eq. 34 presents the energy balance in P2V market.


To ensure the balance in the P2V market, the aggregator executes four hierarchical rules. Thus, an error is calculated according to Eq. 35 to indicate the difference between the sell and buy energy across all time periods.


The error can be obtained in each iteration of the process and considers the energy sold by the prosumers and bought by the EVs. When the process has been finalized, the value of error should be minimal.

Four different rules are created to achieve the minimal error and the convergence of the coordinator process. One algorithm per each rule is presented in order to facilitate the interpretation of the corresponding rule. The first rule is defined in Eq. 36.

Rule1:P¯j,t,(it=2)EVP2VBuy={0if i=1NiPi,tP2Vsell=0P¯j,t,(it=1)EVP2V buyotherwise,tNt,jNj.(36)

Rule 1 is applied to update the values of EV electricity maximum buy limit in the P2V market for the second iteration. Considering this rule, the EV in the second iteration only can buy electricity in periods when the prosumers are available for sale. Algorithm 1 presents the application process of rule 1.

Algorithm 1. Application of Rule 1 (Eq. 36)

1. Coordinator balance check (Eq. 34)

2. Error calculation (Eq. 35)

3. If Error>1×102 kW and it=1

4.  For  t=1:Nt

5.   For j=1:Nj 

6.    If i=1NiPi,tP2Vsell=0

7.     P¯j,t,(it=2)EVP2buy=0

8.    Else If

9.     P¯j,t,(it=2)EVP2buy=P¯j,t,(it=1)EVP2Vbuy

10.    End If

11.   End For

12.  End For

13.  it=it+1

14. Else If

15. Converged solution

16. End If

17. Return the solution.

Eq. 37 presents the rule executed for the second iteration.

Rule 2: P¯i,t,(it=3)SellP2V={0if j=1NjPj,tP2Vbuy=0P¯i,t,(it=2)Sell P2Votherwise,tNt,iNi.(37)

Rule 2 is applied to the maximum limit of electricity sell in the P2V market for the prosumers side. In this case, in periods where the EVs do not buy electricity in the P2V market, the maximum sales limit for prosumers in this same period is zero. Algorithm 2 presents the application of rule 2.

Algorithm 2. Application of Rule 2 (Eq. 37)

1. Coordinator balance check (Eq. 34)

2. Error calculation (Eq. 35)

3. If Error>1×102 kW and it=2

4.  For  t=1:Nt

5.   For i=1:Ni 

6.    If j=1NjPj,tP2Vbuy=0

7.     P¯i,t,(it=3)SellP2V=0

8.    Else If

9.     P¯i,t,(it=3)SellP2V=P¯i,t,(it=2)SellP2V

10    End If

11.   End For

12.  End For

13.  it=it+1

14. Else If

15. Converged solution

16. End If

17. Return the solution.

Rule 3 in Eq. 38 presents a new update for the maximum buy limit for EV buys in the P2V market.

Rule 3: P¯j,t,(it=4)EVP2VBuy={i=1NiPi,tP2VsellPj,tP2Vbuyif Pj,tP2Vbuy0P¯j,t,(it=3)EVP2VBuyotherwise,tNt,jNj.(38)

Using rule 3, the maximum limit for EVs to buy electricity in the P2V market is limited using the quantity available from prosumers. In this case, in each period that there is electricity sold by the prosumers, the maximum limit for the EVs available to buy will be limited. This limitation will be proportional, considering the maximum electricity available from prosumers. Algorithm 3 presents the application of rule 3.

Algorithm 3. Application of Rule 3 (Eq. 38)

1. Coordinator balance check (Eq. 34)

2. Error calculation (Eq. 35)

3. If Error>1×102 kW and it=3

4.  For  t=1:Nt

5.   For j=1:Nj 

6.    If Pj,tP2Vbuy0

7.     P¯j,t,(it=4)EVP2VBuy=i=1NiPi,tP2VsellPj,tP2Vbuy0

8.    Else If

9.     P¯j,t,(it=4)EVP2VBuy=P¯j,t,(it=3)EVP2VBuy

10.    End If

11.   End For

12.  End For

13.  it=it+1

14. Else If

15. Converged solution

 16 End If

17. Return the solution.

Rule 4 limits the maximum electricity sold by prosumers in the P2V market presented in Eq. 39.

Rule 4: P¯i,t,(it=5)SellP2V={j=1NjPj,tP2VbuyPi,tP2Vsellif Pi,tP2Vsell0P¯i,t,(it=4)SellP2Votherwise,tNt,iNi.(39)

In rule 4, the same process of rule 3 is applied, but for the maximum limit for prosumers sells in the P2V market. Algorithm 4 presents the application of rule 4.

Algorithm 4. Application of Rule 4 (Eq. 39)

1. Coordinator balance check (Eq. 34)

2. Error calculation (Eq. 35)

3. If Error>1×102 kW and it=4

4.  For  t=1:Nt

5.   For i=1:Ni 

6.    If Pi,tP2Vsell0

7.     P¯i,t,(it=5)SellP2V=j=1NjPj,tP2VbuyPi,tP2Vsell

8.    Else If

9.     P¯i,t,(it=5)SellP2V=P¯i,t,(it=4)SellP2V

10.    End If

11.   End For

12.  End For

13.  it=it+1

14. Else If

15. Converged solution

16. End IF

17. Return the solution

Iterative Process

An iterative approach is adopted to solve the coordination process. This is illustrated by the block diagram in Figure 2. The coordinator is responsible for the perfect match between the sales of prosumers and purchases of the EVs in the P2V market. The optimizations of each prosumer and EV are independent, only needing the information of maximum limits for transaction in the P2V market provided by the coordinator.


FIGURE 2. Block diagram process.

The coordinator initializes the process, defines the maximum limits for prosumers and EV transactions in P2V market, and passes the information for each prosumer and EV. Both of those agents optimize their energy costs with the provided information of maximum limits for P2V transactions. Those optimizations run in a parallel and decentralized way in which prosumers and EVs receive and send the required data to the coordinator. The latter receives the P2V transaction information and determines the error considering the electricity sold by prosumers and bought from EV. The convergence is tested through two different criteria: the error value obtained by Eq. 35 and the number of iterations. Considering the error, if the value is equal to or less than 0.001 kW, the process converges. On the other hand, when the process is completed, the limit of iterations (five) is reached. When none of the aforementioned conditions is verified, the process proceeds to the next iteration, and the maximum limits for P2V transactions are updated.

The created rules are applied in a sequential mode with respect to the number of respective iterations. During the iterative process, if the error condition is verified, the model converges, and all rules may not be applied. At the maximum, this process has five iterations.

Case Study

To validate the proposed methodology, a case study with a set of 50 residential prosumers and 40 EVs is adopted.2 In total, the community is constituted by 90 players. All community players have a contract with the retailer to supply the necessary electricity that defines the maximum limit for buying electricity, the maximum limit for injecting electricity into the grid, and the fixed costs. The prosumers and EVs can transact electricity in the P2V market, that is, prosumers’ sell and EVs buy electricity, which presents the mean profiles of generation and conventional load.

The profiles presented in Figure 3 are the mean profiles considering the 50 prosumers. The prosumers present a total consumption of 2001.89 kWh and 1,1417.82 kWh of total PV generation, which correspond to a mean of 40.04 kWh of consumption and 28.36 kWh of generation for each prosumer. The prosumer has installed 248.8 kW of produced capacity for PV generation, that is, a mean of 4.98 kW. Table 1 presents the characteristic of batteries used in the prosumers’ facilities.


FIGURE 3. Mean profiles of prosumers.


TABLE 1. Prosumers batteries characteristics.

Three different batteries for prosumers are selected in the case study. In total, there are 50 units of batteries, one per each prosumer. The three available battery types are randomly distributed among all prosumers. In total, the prosumers have 715 kWh of storage capacity installed. Table 2 presents the characteristics of EVs used in the case study, while Figure 4 presents the EV profiles.


TABLE 2. EV characteristics.


FIGURE 4. EV profiles, (A) movements, and (B) mean consumption.

Figure 4A presents the profiles of EV trips; most of the EV trips happen at 8:15 h and 19:45 h (36 trips). In mornings, the EV starts the movements at 6:15 h and stops at 23:30 h at night. Regarding the total number of periods, the EVs make 780 trips, which correspond to a mean of 8.3 trips per period. Figure 4B presents the mean profile of EV consumption. The peaks of consumption are verified in the same peak periods of EV movements.

The seven EV models presented in Table 2 were also randomly distributed within the 40 available EV users. Tesla Model 3 Standard Range + is the most used model. Considering all EVs, they have 1916.60 kWh of capacity. Table 3 presents the tariffs used in the case study. All buy tariffs are obtained in the EDP Comercial Portuguese electricity retailer.


TABLE 3. Tariffs description.

Table 3 presents three different tariffs that the prosumers and EVs can contract with the retailer. The users should contract the tariff that best fits their needs. Contracted power corresponds to the maximum power that each user can demand from the distribution grid. Fixed costs are always associated with contracted power value; higher contracted power values are associated with higher values of fixed costs. The price of electricity varies in two different periods in the day. Off-peak period (during 22:15 to 8:00 h) are considered the cheapest periods, while peak time (between 8:15 to 22:00 h) is considered expensive. Regarding the sell tariff, the price is defined as linear and can be found in Ambiente. (2020). The limit for export of electricity to the grid is half of the contracted power. In the set of prosumers, 21 of them selected the tariff with 6.90 kVA contracted power, while in the set of EVs, 16 of them selected the tariff with 13.80 kVA contracted power. Price of the P2V market (pP2V)  is obtained considering the mean between the minimum value of ToU tariffs (min(ToUj,t)) and the feed-in tariff. The electricity price of the P2V market is 0.0686 €/kWh, while the minimum EV buy price is 0.0922 €/kWh and the price of export electricity to the grid (fit) is 0.045 €/kWh.


The results of the proposed methodology applied to the case study are shown in this section. The simulations were performed on a computer with an Intel Xeon(R) E5-2620v2@2.1 GHz processor with 16 GB of RAM running Windows 10. To emulate the optimization problem, a MATLAB 2018a with TOMLAB optimization add-on was used. The CPLEX solver was used to optimize the proposed model. The simulations are carried out for a time horizon of 24 h divided into 96 periods (15 min each). The load and generation data are obtained through forecasts. Two different scenarios are considered to enable the comparison: scenario A for the possibility of transacting electricity with retailers and the option of exporting to the grid, and scenario B for the possibility of transacting electricity with retailers, the option of exporting to the grid, and transacting electricity in the P2V market. Table 4 presents the optimization results for a centralized approach and the decentralized approach proposed in this work.


TABLE 4. Optimization results (€).

Table 4 presents the optimization results for the same case study with two different variants (with and without P2V market) and for two different implementations (centralized and decentralized). It was found that the results are the same when the P2V market is not available; however, as expected, the centralized method provides slightly better total costs for the P2V market variant. The only difference is the implementation, which has disadvantages considering the privacy issues. Comparing the two different implementations when the P2V market is available, the centralized implementation has better results with a minimal difference (0.15% comparing the total costs). Analyzing other indicators’ results, different values are presented when considering scenario B in the two different implementations. In the decentralized option, the values of mean prosumer cost decreases (2.04%) and the mean EV costs increase (1.45%). Since each player is trying to make the most advantageous transaction for itself, which leads to a suboptimal cost. On the other hand, in a centralized implementation, the community profit is maximized.

Table 5 presents the optimization time results for both implementation scenarios. In the decentralized implementation, the time presented in each iteration corresponds to the maximum resolution time in the set of all players. Execution times in the decentralized implementation for both scenarios A and B are lower than the times required by the centralized implementation. The big difference and the advantage of the decentralized implementation are verified when the resolution times for scenario B are presented. As can be seen, when the centralized implementation is considered, the resolution time is 144 times greater than the decentralized implementation.


TABLE 5. Optimization time results (seconds).

Figure 5 shows the convergence of the optimization process. Three different variables are presented in Figure 5, the error (obtained by Eq. 34), the value of prosumers sells in P2V, and the EV buys in P2V. The sales and buys should have the same value. In the first iteration of Figure 5, the EVs are buying more units of electricity than the amount available on the market, corresponding to the prosumers’ selling. The electricity sold by the prosumers in the P2V market remains constant in all iterations. However, in the end, the EVs adjust their purchased electricity with what is sold by the prosumers. Throughout the iterations, the amount of purchase of EVs decreases as a result of the application of the rules created, leading the error to zero. In this case, the EVs adapt their actions to the behavior of the prosumers. This is because the amount of electricity available on the part of the prosumers is less than that required by the EVs.


FIGURE 5. Process convergence.

Figure 6 presents the electricity transaction of scenario B in centralized and decentralized implementations. The presented results are very similar, although there are differences, mainly in the electricity exported to the grid. Electricity is exported in the centralized implementation, while it is not exported in the decentralized approach. One of the important aspects observed is the value of electricity traded in the P2V market, which is superior to decentralized implementation. Figure 7 presents the transaction on P2V electricity market considering the centralized and decentralized implementation.


FIGURE 6. Buys and sells of scenario B.


FIGURE 7. Buys and sells of scenario B.

As can be seen in Figure 7, the transactions of P2V for the centralized and decentralized solutions have differences. The main difference is related to the period of transaction: in the centralized approach, the transactions occur between 9:00 h and 19:00 h and also between 21:00 and 22.30 h. In the case of decentralized resolution, the transactions occur during 9:00 h to 16:00 h, which corresponds to the PV prosumers’ production hours. Figure 8 presents the electricity transaction on grid for the decentralized approach.


FIGURE 8. Transactions on grid for decentralized (A) scenario A and (B) scenario B.

Both Figures 8A and B present results for the decentralized resolution, Figure 8A for scenario A, where P2V market is not available, and Figure 8B for scenario B where P2V market is available. The big difference presented in the figures is related to the prosumers’ sell to grid values. In the case of scenario A, there are sells to the grid made by prosumers, while in scenario B, all the electricity units available to be sold is sold in the P2V market. Figure 9 presents the mean costs for prosumers and EV of scenario B.


FIGURE 9. Mean costs of Scenario B.

The mean costs for prosumers and EVs regarding the iterations are presented in Figure 9. The mean values for decentralized implementation vary in the case of EV, but in prosumers’ case, the value is constant. The mean value of EV increases throughout interactions. In the fifth iteration, the value is higher than the value of the first iteration because they decrease the value of electricity bought in the P2V market, which has a better price for EVs. As the liquidity of electricity is not sufficient for the amount needed by the EVs, they have to buy from the retailer and pay a higher price. Buying at the retailer rates increases the average of electricity costs.

Conclusion and Future Works

This study presented a decentralized approach for a prosumer-to-vehicle (P2V) market at a local energy community composed of 90 players [50 prosumers and 40 electric vehicles (EVs)]. The results using the P2V market mechanism show a reduction in the total energy costs and the average costs of each player’s type. Comparing the results of centralized with decentralized implementations, the difference in total costs is minimal, but the optimization time difference is significantly higher. Other issues may arise regarding the centralized implementation, such as data privacy. In the case of decentralized implementation, players perform their optimization and only share the values referring to the P2V market. Cyberattacks can also be an important aspect of decentralized implementation. In the centralized implementation, if a cyberattack occurs, the operation of the system can be stopped, leaving users without service. In the case of decentralized systems, as distributed by the various users, an attack will only affect the targeted user, while others remain safe.

The influence of the P2V market depends on the quantity of energy available from the prosumers’ side. As can be seen, by using rules created, the EV adapts the electricity bought in the P2V market to the electricity sold to the prosumers in the same market. Most of them have PV installations, and it is possible to assume that enough amount will be available in future. The use of small thermoelectric generation units can be a solution to increase the supply capacity for the P2V market. Still, the higher production costs of those units can be a barrier.

The P2V market allows prosumers to benefit the local distribution grid and the energy community. As a future work, the authors intend to compare this approach with other decentralized methods available in the literature. The authors are considering the possibility to implement the ADMM technique, although the application of this technique involves proof of concepts that sometimes are not possible to obtain and fully prove the convergence of the implementation. Considering dynamic pricing in the P2V market is another relevant aspect worthy to be explored in the future. The inclusion of dynamic pricing in the P2V market can encourage the users to participate in local energy transaction. Participating in such markets could lead to higher benefits for prosumers and the EV owners. In this case, the idea would be to vary the price of electricity in the P2V market with the amount of electricity offered and required. An important aspect that serves as a subject for future work is the study of the vulnerabilities that the system presents in terms of cyber security and the effective mechanisms and measure to protect the users.

Data Availability Statement

The datasets presented in this study can be found in online repositories. The names of the repository/repositories and accession number(s) can be found below:

Author Contributions

JS and RF developed the concept and decentralized optimization model; JS wrote the article and supervised the work; RF wrote the article, implemented the model in TOMLAB, and conducted the experiments; MG wrote the literature review and reviewed the article; JF reviewed the optimization model and rewrote sections of the work; JS, MG, JF, and ZV reviewed the article, ZV and JS supervised the work and the fund acquisition.


This work has received funding from FEDER Funds through COMPETE program and from National Funds through (FCT) under the projects CENERGETIC (PTDC/EEI-EEE/28983/2017), CEECIND/02814/2017 (JS grant), SFRH/BD/133086/2017 (RF PhD grant). We also acknowledge the work facilities and equipment provided by GECAD research center (UIDB/00760/2020) to the project team. Brazilian Federal Agency for Support and Evaluation of Graduate Education (CAPES), in the scope of the Program CAPES-PrInt, process number 88887.310463/2018-00, International Cooperation Project number 5-P2-1479.

Conflict of Interest

The authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Publisher’s Note

All claims expressed in this article are solely those of the authors and do not necessarily represent those of their affiliated organizations, or those of the publisher, the editors, and the reviewers. Any product that may be evaluated in this article, or claim that may be made by its manufacturer, is not guaranteed or endorsed by the publisher.


We thank our funders and RF for collaborating for CENERGETIC in the scope of pursuing his PhD.


1Environmental, Social, and Governance (ESG) is a set of criteria and standards to enable socially and sustainable conscious decision investments within a company.

2All data are available in the public datset:


Ambiente, A. C. (2020). Portaria n.o 80/2020. Portugal: Diário da República n.o 60/2020. Available at:

Google Scholar

Barbier, E. B. (2020). Greening the Post-Pandemic Recovery in the G20. Environ. Resource Econ. 76, 685–703. doi:10.1007/s10640-020-00437-w

PubMed Abstract | CrossRef Full Text | Google Scholar

Chung, H.-M., Li, W.-T., Yuen, C., Wen, C.-K., and Crespi, N. (2019). Electric Vehicle Charge Scheduling Mechanism to Maximize Cost Efficiency and User Convenience. IEEE Trans. Smart Grid 10 (3), 3020–3030. doi:10.1109/TSG.2018.2817067

CrossRef Full Text | Google Scholar

Das, H. S., Rahman, M. M., Li, S., and Tan, C. W. (2020). Electric Vehicles Standards, Charging Infrastructure, and Impact on Grid Integration: A Technological Review. Renew. Sustain. Energ. Rev. 120 (March), 109618. doi:10.1016/j.rser.2019.109618

CrossRef Full Text | Google Scholar

Elbatawy, S., and Morsi, W. G. (2021). Integration of Prosumers with Battery Storage and Electric Vehicles via Transactive Energy. IEEE Trans. Power Deliv. 5 (c), 1. doi:10.1109/TPWRD.2021.3060922

CrossRef Full Text | Google Scholar

Faia, R., Soares, J., Pinto, T., Lezama, F., Vale, Z., and Corchado, J. M. (2021a). Optimal Model for Local Energy Community Scheduling Considering Peer to Peer Electricity Transactions. IEEE Access 9, 12420–12430. doi:10.1109/ACCESS.2021.3051004

CrossRef Full Text | Google Scholar

Faia, R., Soares, J., Vale, Z., and Corchado, J. M. (2021b). An Optimization Model for Energy Community Costs Minimization Considering a Local Electricity Market between Prosumers and Electric Vehicles. Electronics 10 (2), 129. doi:10.3390/electronics10020129

CrossRef Full Text | Google Scholar

Fotouhi Ghazvini, M. A., Lipari, G., Pau, M., Ponci, F., Monti, A., Soares, J., et al. (2019). Congestion Management in Active Distribution Networks through Demand Response Implementation. Sustainable Energ. Grids Networks 17 (March), 100185. doi:10.1016/j.segan.2018.100185

CrossRef Full Text | Google Scholar

Gesevičius, K., Catalão-Lopes, M., Carvalho, P. M. S., and Carvalho, S. (2021). The Impact of Electric Vehicles' Market Expansion on Wholesale Electricity price - the Case of Lithuania. Case Stud. Transport Pol. 9, 477–487. doi:10.1016/j.cstp.2021.02.003

CrossRef Full Text | Google Scholar

Irle, R. (2021). “Global Plug-In Vehicle Sales Reached over 3.2 Million in 2020.” 2021.

Google Scholar

Lezama, F., Soares, J., Hernandez-Leal, P., Kaisers, M., Pinto, T., and Vale, Z. (2019a). Local Energy Markets: Paving the Path toward Fully Transactive Energy Systems. IEEE Trans. Power Syst. 34 (5), 4081–4088. doi:10.1109/TPWRS.2018.2833959

CrossRef Full Text | Google Scholar

Lezama, F., Soares, J., and Vale, Z. (2019b). “Optimal Bidding in Local Energy Markets Using Evolutionary Computation,” in In 2019 20th International Conference on Intelligent System Application to Power Systems (ISAP) (New Delhi, India: IEEE), 1–6. doi:10.1109/ISAP48318.2019.9065976

CrossRef Full Text | Google Scholar

Lieven, T.. 2021. “Has COVID-19 Strengthened Environmental Awareness?” doi:10.21203/

CrossRef Full Text | Google Scholar

Lüth, A., Weibezahn, J., and Zepter, J. M. (2020). On Distributional Effects in Local Electricity Market Designs-Evidence from a German Case Study. Energies 13 (8), 1993. doi:10.3390/en13081993

CrossRef Full Text | Google Scholar

Masood, A., Hu, J., Xin, A., Sayed, A. R., and Yang, G. (2020). Transactive Energy for Aggregated Electric Vehicles to Reduce System Peak Load Considering Network Constraints. IEEE Access 8, 31519–31529. doi:10.1109/ACCESS.2020.2973284Sayed

CrossRef Full Text | Google Scholar

Matamoros, J., Gregori, M., Gómez, J., Pouttu, A., Pedro, H., Nardelli, J., et al. (2016). P2P Energy Trading : Market Design and Optimization, D4.3.

Google Scholar

Mengelkamp, E., Staudt, P., Garttner, J., and Weinhardt, C. (2017). “Trading on Local Energy Markets: A Comparison of Market Designs and Bidding Strategies,” in 2017 14th International Conference on the European Energy Market (EEM) (IEEE), 1–6. doi:10.1109/EEM.2017.7981938

CrossRef Full Text | Google Scholar

Mustafa, M. A., Cleemput, S., and Abidin, A. (2016). “A Local Electricity Trading Market: Security Analysis,” in 2016 IEEE PES Innovative Smart Grid Technologies Conference Europe (ISGT-Europe) (IEEE), 1–6. doi:10.1109/ISGTEurope.2016.7856269

CrossRef Full Text | Google Scholar

Oprea, S.-V., and Bâra, A. (2021). Devising a Trading Mechanism with a Joint Price Adjustment for Local Electricity Markets Using Blockchain. Insights for Policy Makers. Energy Policy 152 (February), 112237. doi:10.1016/j.enpol.2021.112237

CrossRef Full Text | Google Scholar

Sæther, G., Crespo del Granado, P., and Zaferanlouei, S. (2021). Peer-to-Peer Electricity Trading in an Industrial Site: Value of Buildings Flexibility on Peak Load Reduction. Energy and Buildings 236 (April), 110737. doi:10.1016/j.enbuild.2021.110737

CrossRef Full Text | Google Scholar

Strauch, Y., Carter, A., and Homer-Dixon, T. (2020). However the Pandemic Unfolds, It's Time for Oil Use to Peak-And Society to Prepare for the Fallout. Bull. At. Scientists 76 (5), 238–243. doi:10.1080/00963402.2020.1806577

CrossRef Full Text | Google Scholar

Wan, D., Xue, R., Linnenluecke, M., Tian, J., and Shan, Y. (2021). The Impact of Investor Attention during COVID-19 on Investment in Clean Energy versus Fossil Fuel Firms. Finance Res. Lett., 101955. doi:10.1016/

CrossRef Full Text | Google Scholar

Zhang, C., Wu, J., Zhou, Y., Cheng, M., and Long, C. (2018). Peer-to-Peer Energy Trading in a Microgrid. Appl. Energ. 220, 1–12. doi:10.1016/j.apenergy.2018.03.010

CrossRef Full Text | Google Scholar

Zhang, Z., Li, R., and Li, F. (2020). A Novel Peer-To-Peer Local Electricity Market for Joint Trading of Energy and Uncertainty. IEEE Trans. Smart Grid 11 (2), 1205–1215. doi:10.1109/TSG.2019.2933574

CrossRef Full Text | Google Scholar

Keywords: decentralized control, energy community, local electricity markets, prosumer, electric vehicle

Citation: Faia R, Soares J, Fotouhi Ghazvini MA, Franco JF and Vale Z (2021) Local Electricity Markets for Electric Vehicles: An Application Study Using a Decentralized Iterative Approach. Front. Energy Res. 9:705066. doi: 10.3389/fenrg.2021.705066

Received: 04 May 2021; Accepted: 08 September 2021;
Published: 04 November 2021.

Edited by:

Hussein T. Mouftah, University of Ottawa, Canada

Reviewed by:

Chau Yuen, Singapore University of Technology and Design, Singapore
Kenneth E. Okedu, National University of Science and Technology, Oman
Binod Vaidya, University of Ottawa, Canada

Copyright © 2021 Faia, Soares, Fotouhi Ghazvini, Franco and Vale. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY). The use, distribution or reproduction in other forums is permitted, provided the original author(s) and the copyright owner(s) are credited and that the original publication in this journal is cited, in accordance with accepted academic practice. No use, distribution or reproduction is permitted which does not comply with these terms.

*Correspondence: João Soares,