1. Introduction
Energy communities are social aggregations of entities, that exchange energy among themselves through the public grid they are connected to. The single entities may engage in generation (especially from renewable energy sources), consumption, and energy storage, as well as provide energy services to other community members or the public grid. Participation of entities in an energy community is voluntary and open. To solicit this participation, the primary purpose of energy communities is to provide environmental, economic, or social benefits to its members or shareholders [
1]. This process can also be favored by existing social relationships [
2]. Several pilot studies carried out worldwide have shown that aggregation is actually capable of generating benefits of different types (see, e.g., [
3,
4]).
The constitution of, as well as incentives granted to, energy communities are regulated by national or local laws [
5], whereas each energy community may typically decide the internal mechanisms governing its operation. Indeed, an energy community is based on a physical layer, whose components (loads, distributed energy resources, energy storage systems, electric vehicles) should be suitably coordinated, managed, and controlled to fully exploit all the benefits of aggregation.
In the literature, energy volumes to be exchanged within a community are often obtained together with energy prices by clearing a suitably designed local energy market. Local energy markets can be organized either in a centralized or peer-to-peer fashion (see [
6] for a comprehensive review). The centralized solution is typically based on a community operator, who manages trading activities inside the community, as well as plays the role of intermediator between the community and the rest of the system [
7,
8,
9]. In peer-to-peer market design, entities directly negotiate with each other, achieving consensus on an energy transaction for a certain amount of energy and a price without centralized supervision [
10,
11,
12]. The mechanism governing the operation of a community may also include a strategy to redistribute community benefits among the members [
7].
Besides energy exchange among its members, energy communities may also engage in providing flexibility and services to the grid, e.g., through enrollment in demand response programs and the provision of reserves. Another option, as explicitly highlighted in [
1], is to provide charging services for electric vehicles (EVs). Given the increasing penetration of EVs in the transportation sector [
13], this option is expected to become more and more concrete, and bring benefits at different levels. Indeed, mass adoption of EVs is known to have a number of impacts on distribution grid operation and management [
14,
15]. One of these is the high peak power consumption determined by the simultaneous charging of a large number of EVs [
16]. In this respect, EV charging within energy communities could help reduce peak power thanks to the overall optimization performed at the community level. Moreover, including EVs in energy communities could provide additional flexibility to enable the integration of renewable energy into existing power grids. At the user level, social and economic benefits are expected because the energy for EV charging can be bought at cheaper prices resulting from the internal market of the community [
7]. To achieve the expected benefits, EV charging has to be suitably scheduled and optimized. The management of EV charging stations connected to distribution grids has been addressed in numerous contributions, see, e.g, [
17,
18,
19,
20,
21,
22]. However, to the best of the authors’ knowledge, the optimal integration of a fleet of EVs into energy communities has received little attention so far. The energy management system for a public EV charging station integrated within a community microgrid is proposed in [
23]. The aim is to minimize the cost of energy for EV charging and to meet the community demand while maximizing the revenue from selling the surplus energy of a photovoltaic (PV) system and the energy discharged from EVs. The scheduling of a community-integrated energy system with an EV charging station is considered in [
24]. Here, an integrated demand response program is designed to promote a balance between energy supply and demand. In both contributions, the resulting problems are formulated in the framework of mixed integer programming.
In this paper, we extend the energy community architecture proposed in [
7], by introducing a new entity that manages a fleet of EVs for rent. A local market based on the marginal pricing scheme is organized at a centralized level. The market aims at maximizing the social welfare of the community. This is performed by defining energy prices and volumes to achieve a more efficient allocation of resources, a reduction in the peak, and an increased amount of reserve at the community level. Since we focus on a setup where EV rental requests are submitted to the community one day ahead, two additional problems must be addressed. First, each rental request must be assigned to a vehicle. Then, the optimal EV charging scheduling must be found. A community operator is assumed to manage the market and to redistribute the community benefits among the entities, in such a way that the solution achieved by each entity within the community is not worse than that obtained by acting individually. Different from [
7], where the clearing of the local market is formulated as a linear program, in this work the request-to-vehicle assignment requires the introduction of binary variables, which makes the local market optimization problem a mixed-integer linear program (MILP). To avoid the high worst-case computational complexity of solving the MILP (as could be faced in practice, when the numbers of EVs and requests increase), a heuristic procedure is proposed to solve the assignment problem, based only on the set of the received requests. Once the assignment of requests to vehicles has been fixed, the local market optimization problem becomes again a linear program, that can be efficiently solved. Numerical results presented in the paper show that the proposed heuristics has a very cheap cost in terms of computation time, and performs very well in instances for which the MILP can be solved at the optimum, thus making it possible to compare the solution of the heuristics with the optimal one.
The paper is organized as follows.
Section 2 reviews the problems formulated in [
7] for the clearing of the local market, and the redistribution of community benefits. The two problems are presented in a unified fashion in the form of a bi-level program.
Section 3 shows how to include a fleet of EVs for rent in the framework previously introduced. The proposed heuristic solution to the request-to-vehicle assignment is described in
Section 4. Numerical results are reported in
Section 5 and discussed in
Section 6. Finally,
Section 7 draws the conclusions.
Notation: The subscript t is used to denote a discrete time instant within the considered time horizon . The time between two consecutive time instants is denoted by . The subscript u is used to denote an entity in the entity set . The subscript d denotes an EV in the vehicle set . Finally, the subscript h is used to denote an EV service request in the request set .
2. Energy Community Model
An energy community is a collection of entities located in the same geographical area that pool their resources using the public distribution network. Entities can be very heterogeneous, ranging from residential customers to small and medium-sized enterprises. In general, an entity is characterized by a number of different components that may include one or more loads (sheddable or non-sheddable), generators (steerable or non-steerable), electrical storage systems and EV charging stations. The members of a community exchange electricity between them, share energy storage systems and provide services to the external grid. An energy community may bring several benefits, such as energy cost savings, peak cost reduction and provision of reserve on an aggregate basis.
While it is assumed that the entities are connected to the same local bus, the energy community provides a virtual layer over which entities may exchange energy flows (see
Figure 1). Denote by
and
the energy exported to and imported from the grid by entity
u at time
t. Moreover, let
and
be the energy exported to and imported from the community by entity
u at time
t. Then, the net energy flowing from entity
u to the local bus amounts to
. Since the energy balance at the community level implies
, the net energy flowing from the grid to the local bus is
.
It is assumed that the energy flows with the external grid are subject to the same pricing mechanism as if the entities were not part of a community. Conversely, the peak power penalty is applied to the aggregate net power flow, and the provision of the reserve to the grid is remunerated at the community level, depending on the aggregate amount of power reserve provided. A
community operator coordinates the behavior of the entities in order to maximize the benefits for the community. On the day ahead, the operator collects the load and generation profiles of each entity, as well as their flexibility, and schedules the operation of the devices based on the prices of the electricity imported from or exported to the grid. For the remuneration of this activity, the entities pay a fee to the operator, which is assumed to be proportional to the aggregate amount of energy exchanged within the community, i.e., it is equal to
, where
[€/kWh] is a given unitary price. In [
7], an optimization model was proposed to solve the problems that the community operator has to face. In the following, such a model is briefly reviewed. For the sake of exposition, the mathematical details are skipped and the interested reader is referred to [
7] for an exhaustive description. In
Section 3, it will be shown how to extend this model so as to include the management of a fleet of EVs for rent.
The community operator has to determine the energy flows among the entities and the corresponding prices (i.e., the operator has to
clear the market), and then it has to share the profits among the community members. These tasks can be simultaneously formulated as a
bi-level model, which is a mathematical program composed of two nested optimization problems, termed upper and lower level [
25]. In general, a bi-level model can be written as
where
F and
f are the objective functions of the upper and lower level problems (
1) and (
2), respectively. In the framework considered in [
7], the lower-level problem models the market clearing task, while the upper-level problem takes care of profit redistribution. In the following, we outline the main features of both problems.
2.1. Lower Level Problem
The objective function
of problem (
2) represents the social welfare of the community over a given time horizon
. It is composed of three terms:
The term
accounts for costs and revenues related to the energy flows. Among others, they include the costs of energy purchased from the grid or from the community, the costs of shed demand and steered generation, the costs of storage usage and the fees paid to the community operator. The revenues come from selling energy to the grid or to other community members. The term
represents the revenues collected by the community for providing symmetric reserve to the grid. It is assumed that the revenue is proportional to the aggregate reserve
provided by the community, i.e., it is equal to
, where
[€/kW] is a given reserve price. The term
corresponds to the loss incurred by the community for the peak power
consumed by the community from the grid over the time horizon
, and it is equal to
, where
[€/kW] is the peak price. The vector of the optimization variables
includes the energy volumes exchanged by each entity and the charging/discharging profiles of the storage devices. The feasible set
is used to enforce technical constraints on the optimization variables (e.g., maximum steerable generation, maximum capacity of a storage system, etc.), as well as to model the storage dynamics and to guarantee the energy balance for each entity at all times. In [
7], it is shown that the lower level problem (
2) can be cast as a linear program and thus efficiently solved. Moreover, according to the marginal pricing framework [
26], the dual variables of the energy balance constraints represent the optimal purchase/selling prices of the energy traded within the community.
2.2. Upper Level Problem
The purpose of problem (
1) is to share the community profit among the entities according to a given redistribution policy. A possible choice is to maximize the smallest (absolute or relative) profit increase that the entities experience when participating in the community. The objective function
naturally reflects the chosen policy. The optimization variables
x include the fraction of revenues from reserve provision and peak costs that are ascribed to each entity, as well as slack variables instrumental to encoding the redistribution policy in the objective function. The feasible set
ensures that no entity is penalized compared to acting individually. In particular, this means that when participating in the community, the profit of each entity cannot be less than the profit the entity would achieve by acting individually.
Remark 1. In a bi-level model (1) and (2), the optimizer and the feasible set of the lower level depend, in general, on the optimization variables x of the upper level. In turn, the feasible set of the upper level may depend on . However, in the considered application, the lower level problem (2) is a linear program that does not depend on x, i.e. , see (3). Moreover, for a given solution of the lower level problem, the upper level is also a linear program. As a consequence, problem (1) and (2) can be efficiently solved as the cascade of two linear programs, one corresponding to the lower level, and the other corresponding to the upper level. A discussion about possible solution strategies can be found in [7]. 4. Heuristic Assignment
In this section, we present a heuristic solution to the problem of assigning an EV to each request. The requests are sorted by their departure time and they are processed sequentially in that order. The proposed heuristic builds the final assignment incrementally, starting from
, for all
. At iteration
i, a vehicle
is assigned to a new request
by setting
and
for all
and
. In doing so, it must be guaranteed that the resulting assignment
is a feasible assignment. Specifically, three conditions must be met. First,
must satisfy (
8). This amounts to verifying that, in the previous assignment
, vehicle
was not already assigned to requests overlapping with request
. Second, there must exist a feasible charging profile
such that condition (
13) is verified for
,
. Practically, this amounts to checking that, given the initial battery level
in (
10), the previous assignment
and the maximum charge rate
, the battery of vehicle
at departure time
can be charged up to
(the amount of energy required by request
). Third, there must exist a feasible charging profile
such that the constraint
in (
10) is verified. Again, this can be checked from
,
and
.
In general, at iteration i there exist multiple EVs that can be assigned to request without violating any of the above conditions (candidate vehicles). In this case, the heuristic attempts to assign to the most promising candidate vehicle, by maximizing the time that a vehicle has at its disposal to recharge its battery before request begins. For each candidate vehicle , the availability time is computed as the maximum of the return times of the requests associated with vehicle in . Then, request is assigned to the candidate vehicle having the earliest availability time. Intuitively, the heuristic tries to maximize the time between two consecutive requests that must be served by the same vehicle. This choice aims at introducing more flexibility in the charging schedule problem to be solved afterwards, thus obtaining less suboptimal results.
Remark 3. When the assignment problem is addressed by means of the proposed heuristic procedure, problem (2) boils down to a linear program, since the binary variables are assigned. Hence, the overall bi-level model (1) and (2) can be efficiently tackled by solving two linear programs sequentially. The resulting flow chart is shown in Figure 2b. The proposed procedure leads to a dramatic reduction in the computational burden, although it is not guaranteed to return the optimal solution. However, numerical simulations have shown that the heuristic solution attains a cost close to the optimal one. These aspects will be extensively discussed in the next sections. 5. Numerical Results
To validate the proposed approach, three examples are provided. The first two are toy examples reported to illustrate how the proposed procedure works, while a third example aims at evaluating the procedure’s performance and computational feasibility in a more realistic scenario. In each example, a comparison between the proposed heuristic for vehicle assignment and the optimal solution of the MILP is carried out. In all simulations, the optimization horizon is assumed to be 24 h. In the following examples, the peak price is set to
€/kW, while the reserve price is
€/kW. Finally, the fee received by the community operator is
€/kWh. Simulations have been performed on Matlab, the optimization problem is formulated in Yalmip [
27] and solved by Gurobi [
28] on an Intel i7-11700 @
GHz, 32 GB of RAM.
Example 1. Let us consider a community composed of three entities, and let us perform a simulation of one day. The sampling time is set to h. The first entity is assumed to be a non-flexible load, whose demand of 5 kW is kept constant throughout the day. The second entity may provide steerable generation up to kW, while the third entity is equipped with two identical EVs. EV battery capacities are set to kWh with a maximum charging power kW. Battery efficiencies are set to . Three EV requests are considered, as detailed in Table 1. Electricity prices for import from and export to the grid are assumed to be constant during the day and equal to €/kWh and €/kWh, respectively. Moreover, the unit cost of steerable generation is assumed constant and amounts to €/kWh.
In
Table 2, the request assignment is reported. Specifically, an entry is labeled if a vehicle and a request are matched by one of the procedures (H stands for heuristic, while O stands for the optimal MILP solution). In this setup, the optimal solutions obtained from solving the MILP and applying the proposed heuristic coincide.
In fact, to mitigate the peak power consumption, the optimal allocation is the one that maximizes the time between consecutive requests of each vehicle, since it provides more flexibility for the recharge. In
Figure 3, it can be noticed that EV batteries are charged at a power rate lower than its maximum, in order to limit the peak consumption.
Notice that the power imported from the grid never exceeds kW and the steerable generation facility (entity 2) sells all the generated energy to the community in order to achieve the minimum aggregated cost. From the community market point of view, the prices change three times a day. At the beginning of the day, only entity 1 is demanding energy, which is satisfied by the steerable generation. From 9 to 13, the EV charging process begins, but the power imported from the grid remains below the daily peak, which occurs in the last part of the day when the community is asking the grid for a constant power of kW. The community incurs an overall cost of with respect to a total cost of if each entity would act alone exchanging energy only with the grid.
The energy flows at the community level and the community prices are reported in
Figure 4.
Example 2. To provide an example where the heuristic is suboptimal, a setup similar to that reported in the previous example is considered. The same data of Example 1 have been used, except for the price of energy imported from the grid, and the maximum amount of steerable generation. The import energy price is set to €/kWh for , while it remains €/kWh for the rest of the day. The maximum steerable generation is null from 9 to 17, while it is set to kW at other times.
It is apparent that it is not convenient to charge vehicles in the interval [
9,
17] since the energy price is doubled and steerable generation is not available. However, the solution returned by the heuristic coincides with that of Example 1, because it does not depend on prices and on other entity features. On the other hand, the optimal MILP solution assigns the first two requests to one EV and the last one to the other vehicle, as reported in
Table 3. In this case, the optimal cost incurred by the community is
€, while that provided by the heuristic assignment amounts to
€.
Example 3. Let us consider a more realistic framework composed of 5 entities as described in Table 4. Each table entry denotes the number of non-flexible loads (nfl), sheddable loads (she), non-steerable generators (nst), steerable generators (ste), storage systems (sto) and EVs. Notice that, entity 5 is equipped with 10 identical vehicles. A simulation of 100 days is carried out, solving problem (1) and (2) for each day. The sampling time is min. The non-flexible energy demand profiles for entities 2 and 4 in a given day are depicted in Figure 5. Such profiles are a slightly perturbed version of those reported in [29]. Sheddable loads of entities 1 and 3 can reduce their consumption up to of the nominal value. Non-steerable generation is assumed to be provided by PV plants (see Figure 6), whereas the steerable generators are capable of producing up to 5, , 8 kW of electrical power for entities 1, 2 and 3, respectively. The storage system of entity 3 has a capacity of 40 kWh with maximum charging/discharging power equal to 10 kW, while the charging and discharging efficiencies are both set to .
Regarding the vehicles associated with entity 5, a set of 10 EVs with identical specifications are considered. Their battery capacity is kWh, while their maximum charging power and battery efficiency are set to kW and , respectively. For each day, up to 30 EV service requests are considered. These requests are chosen to ensure the feasibility of the heuristic procedure. Departure times are drawn from a discrete uniform distribution from 1 to 108 time steps, corresponding to the range 12 a.m.–6 p.m. On the other hand, for a given EV request h, its duration is set according to a discrete uniform distribution from 1 to 4 h. The energy required by each request follows a uniform distribution in the interval kWh. Finally, the prices of energy imported from the grid are taken from the Italian electricity market [30] (see Figure 7), while the export energy prices are set to of the import energy prices. The unit cost of sheddable demand and steerable generation are considered constant throughout the day and their values are €/kWh and €/kWh, respectively.
Concerning the simulation results, the procedure based on the heuristic assignment provides an average community daily cost of
, whereas the total cost of all the entities acting individually would be
. Energy flows and community prices for a given day are reported in
Figure 8.
Focusing on the entity hosting EVs, it would incur an average daily cost of by acting alone, while joining the community grants a cost reduction of . To evaluate the optimality level of the heuristic, the solution obtained by the proposed procedure is compared to that returned by the MILP. In the considered setup, the two approaches show similar results. In fact, the maximum daily gap between the two solutions is less than .
Regarding the computation time, the average time to find a solution to problem (
1) and (
2) for one day using the heuristic procedure or solving the MILP is
and
s, respectively. Hence, in this case, the proposed heuristic is around 200 times faster than the optimal procedure.
6. Discussion
While Examples 1 and 2 reported in the previous section are toy examples aimed at illustrating how the proposed procedure works, Example 3 is more realistic and allows one to obtain insight into the potential performance of the proposed approach.
The main outcome is that the cost of EV charging is significantly reduced when the rental service operates within the energy community (more than 10% in the considered setup). Notice that this comes at no expense to the other community members. Overall, the community enjoys an average daily cost saving of about 15€, which is then shared among all the entities. The adopted redistribution policy ensures that, when participating in the community, all the entities benefit from a cost reduction, compared to operating alone (i.e., outside the community).
In order to evaluate the level of conservatism introduced by the heuristic assignment procedure presented in
Section 4, the heuristic solution (i.e., the one computed as in
Figure 2b) was compared with the optimal solution (i.e., the one computed as in
Figure 2a). Notice that the latter requires the solution of a MILP, whose complexity scales badly with the number of binary variables. This was the reason of the size of Example 3, in which the number of entities and EVs was chosen such that the MILP could be solved in reasonable time. Quite remarkably, the cost returned by the heuristic solution is very close to the optimal one, with a performance degradation that is always less than 1%. As a matter of fact, on many days, the heuristic assignment coincides with the optimal one.
A third aspect that was analyzed is the computational complexity of the proposed approach. In the considered example, the processing time required to compute the heuristic solution is about 200 times less than that needed to find the optimal solution. Such a dramatic time reduction is expected to be even more evident in larger and more realistic scenarios. Indeed, when the number of EVs increases, the solution of the MILP quickly becomes intractable. On the other hand, the complexity of the proposed approach scales nicely with respect to the problem size, since it does not require the solution of any combinatorial problem. We stress that the possibility of skipping the solution of a MILP is what mainly distinguishes our contribution with respect to [
23,
24].
We stress that the obtained results are in agreement with European energy policy directives [
1], stating that the primary purpose of energy communities is to provide environmental, economic or social community benefits to its members or shareholders. Indeed, the more advantageous energy prices originated within the community bring clear economic benefits to the members, but also induce social benefits, by helping fight energy poverty through lower supply tariffs. Environmental benefits are achieved not only by fostering the penetration of renewable energy sources, but also enabling the decarbonization of the transportation sector by making EV management more affordable. Optimization performed at the community level promotes more virtuous consumption behaviors at the household level, by fostering concepts of common responsibility. Finally, optimal community management brings benefits also at the system level, by enabling the reduction in the peak power resulting from uncoordinated simultaneous charging of a large number of EVs.