Multiagent System for Community Energy Management
Roman Denysiuk
1 a
, Fabio Lilliu
2 b
, Meritxell Vinyals
1
and Diego Reforgiato Recupero
2 c
1
CEA, LIST, 91191 Gif-sur-Yvette, France
2
Department of Mathematics and Computer Science, University of Cagliari, Via Ospedale 72, Cagliari, Italy
Keywords:
Multiagent System, Local Energy Community, Demand Response.
Abstract:
Local energy communities (LECs) represent a shift in energy management from an individual approach to-
wards a collective one. LECs can reduce energy costs for end-users and contribute to meeting climate objec-
tives through the use of renewable energy. This paper presents the application of a multiagent system (MAS)
approach to realize the concept of LEC in a real-world scenario involving a community of households. An ap-
propriate agent-based model for the given community is presented. This model effectively distributes the tasks
among the agents considering electrical and heat energy flows. The agent coordination mechanism is based
on the Alternative Direction Method of Multipliers. The obtained results provide evidence of the validity of
the developed MAS and show its potential to increase a total social welfare of the community.
1 INTRODUCTION
Local energy communities are considered a promis-
ing way to integrate distributed energy resources and
to engage end-users in sustainable energy practices.
In LECs, participants can locally buy and sell their
energy. When production inside the community is not
sufficient to meet local demand, the electricity short-
age is covered by import from the main grid. On the
other hand, the surplus energy can be exported to the
grid. By acting together, community members have
a stronger negotiation power when interacting with
other energy market participants. The trade inside the
community is encouraged by the difference between
local and retail prices. Trading locally is beneficial
because it allows funds remain within local economy.
This also reduces losses that occur when the energy is
transmitted over long distances.
The recent interest in LECs contributed to a grow-
ing number of industrial projects and research pub-
lications (Sousa et al., 2019). Some focus on the
design of a peer-to-peer (P2P) market with neces-
sary functions where peers can buy and sell their en-
ergy. Thus, (Mihaylov et al., 2014) proposed a vir-
tual currency to regulate energy exchange between
peers. The payment functions for those supplying
and consuming energy were developed to encourage
a
https://orcid.org/0000-0002-6847-8313
b
https://orcid.org/0000-0003-1140-4433
c
https://orcid.org/0000-0001-8646-6183
the energy balance. The approach is dependent on
function settings (Lilliu et al., 2019) and does not ac-
count for a strategic behavior of peers. The latter is
often addressed using a game theory. (Paola et al.,
2017) proposed price-based schemes and a game-
theoretical framework to coordinate flexible demand.
Though, distributed generation and energy storage
systems were not taken into consideration. (Shamsi
et al., 2016) suggested an auction-based market mech-
anism, where each household provides bids or offers
of their demand or generation. These offers and bids
are collected to allocate energy and determine prices.
In the auction based market, accurate estimates of en-
ergy and prices are needed to get better tariffs. This
can be disadvantageous to inexperienced participants.
A major advantage of P2P schemes is that they are
able to preserve privacy as there is no central supervi-
sory entity.
A more structured market design enables a cost
sharing mechanism where community members pay
in the form of a share of a single electricity bill
of the overall community. This design assumes the
coordination of actions towards the common goal.
Thus, (Long et al., 2018) proposed a two stage aggre-
gated control to realize a P2P energy sharing where
an energy sharing coordinator controls flexible de-
vices. An interior-point method was used to min-
imize the energy costs of the community. A cen-
tralized in nature is its major disadvantage that is
also common to many existing approaches based on
energy sharing. The centralization limits scalability
28
Denysiuk, R., Lilliu, F., Vinyals, M. and Recupero, D.
Multiagent System for Community Energy Management.
DOI: 10.5220/0008914200280039
In Proceedings of the 12th International Conference on Agents and Artificial Intelligence (ICAART 2020) - Volume 1, pages 28-39
ISBN: 978-989-758-395-7; ISSN: 2184-433X
Copyright
c
2022 by SCITEPRESS Science and Technology Publications, Lda. All rights reserved
and rises concerns about privacy. Multiagent systems
(MAS) are promising alternative to decentralize com-
putations. (Kantamneni et al., 2015) surveyed MAS
applications for microgrid control. Energy trading in
the community using MAS was recently addressed
by (Vinyals et al., 2018). Although this approach pre-
sented an agent-based model of the community, a lim-
ited number of flexible devices and only the flow of
electricity were considered.
This study presents a multiagent system devel-
oped to manage a community of households located
in the central Netherlands. Our approach is close to
cost sharing ones. We describe the developed agent-
based model of the community energy network. This
model accounts for the flows of electrical and heat
energy. The model conveniently decomposes the un-
derlying optimization problem so that each agent is
assigned with a specific task that can be solved ef-
ficiently. In particular, we present an agent-based
decomposition for addressing the model of battery
with losses. This contrasts with existing approaches.
For example, (Yang and Nehorai, 2014) addressed the
problem directly introducing additional parameter for
optimization. Furthermore, the presented MAS ap-
proach is not limited to the considered community
and can be adapted to other real-world scenarios.
2 CASE STUDY
The present study has been carried out in the scope
of a European project whose aim is to unlock a de-
mand response potential in the distribution grid. The
addressed case study involves a community of house-
holds located in the central Netherlands. Figure 1 de-
picts the architecture of community and aggregator
platform. This figure presents a logical architecture
rather than the physical one. This view is applicable
to manage: (i) households located in a close neighbor-
hood sharing a common point of connection with the
main grid, as shown in Figure 1 and (ii) households
that are geographically distant and have no physical
common point coupling.
The considered community consists of 16 house-
holds and a district battery with the capacity of 220
kWh. Each house has a heat pump of 2 kW combined
with a hot water buffer of 200L. The heat pump is
used for heating both domestic hot water and spatial
heating. Each house has solar photovoltaics (PV) ca-
pable of producing up to 7kW. Additionally, there is
one in-home battery with the capacity of 7.8 kWh.
The given community is managed by an energy
service providing company know as aggregator. The
aggregator manages flexible assets in the community
Figure 1: Architecture of the energy community.
aiming to maximize the value of flexibility. The ag-
gregator platform facilitates the interaction with ex-
ternal parties and provides an infrastructure for exe-
cuting MAS. It relies on information and communi-
cations technology and consists of different commu-
nication devices, software applications and protocols.
Each house is equipped with a local energy gateway
(LEG) that is connected with flexible devices and is
able to communicate with the backend run on a cloud.
Thus, LEGs are used to control flexible devices and to
communicate sensory data. The Advanced Message
Queuing Protocol is used for communication.
3 MULTIAGENT SYSTEM
The community energy network is modeled as a mul-
tiagent system where agents are nodes and the envi-
ronment is everything outside the agent. The state
of the environment is represented by sensory data in-
cluding the charge levels of batteries, indoor and out-
door temperatures, temperature limits for comfort, the
prices of energy and possible limits for energy flows.
The actions of agents are the amount of energy pulled
from or injected to the grid.
Multiagent System for Community Energy Management
29
Figure 2: Multiagent model of the community energy network.
Table 1: Agent types and their roles.
Notation Description Role
AGRNet Aggregator Net AGRNet represents a local energy market. It aggregates different assets and
ensures the energy balance at the community level.
ENet Electrical Net ENet represents the electrical network in the house energy system. It en-
sures the balance of electrical energy.
HNet Heating Net HNet represents the heating network in the house energy system. It ensures
the balance of heat energy.
BNet Battery Net BNet ensures the energy balance in the decomposed model of battery.
ET External Tie ET represents a connection to an external source of power. This can be
viewed as a connection between the community and the main grid.
C Connector C connects two nets modelling the transmission of energy. The transmis-
sion can be associated with losses. There are no losses between AGRNet
and ENet. The transmission loss from ENet to BNet models a charging
efficiency. The transmission loss from BNet to ENet models a discharging
efficiency.
B Battery B represents an electrical storage that can take in or deliver energy.
PV Photovoltaic PV represents solar panels that generate electricity from absorbing sunlight.
FL Fixed Load FL represents an inflexible energy consumption that must be satisfied.
HP Heat Pump HP transforms electricity to heat energy with some conversion coefficient.
SH Space Heating SH represents indoor air temperature that must be kept within limits for
comfort.
HWS Hot Water Storage HWS represents the tank with hot water and the consumption of domestic
hot water.
3.1 Multiagent Model
Figure 2 shows the multiagent model of the commu-
nity energy network. The energy network is repre-
sented by a bipartite graph having two set of nodes.
This suggests two types of agents, shown by circles
and rectangles. Circles depict device agents (D). The
device can refer to an abstract or physical device.
Rectangles show net agents (N). The net represents a
virtual zone where the energy exchange between the
devices takes place. Edges in the graph indicate inter-
action between agents. Table 1 lists different types of
agents and explains their roles.
ICAART 2020 - 12th International Conference on Agents and Artificial Intelligence
30
The model represents a structure of agent inter-
actions. It extends a multiagent model of a building
by aggregating different buildings and district battery
using AGRNet. This net can be viewed as a local en-
ergy market where district actors negotiate their en-
ergy exchange. AGRNet is also connected to an ex-
ternal source of power that represents a connection
point between the community and the main grid. In-
side a building, there are electrical (shown in blue)
and heating (shown in red) networks that account for
the flows of electricity and heat. Net agents ensure the
balance of corresponding energies. Connector agents
that connect houses to the AGRNet represent pro-
sumers in the local energy market. They communi-
cate schedules for houses while keeping energy flows
inside houses hidden at the community level. The bat-
tery with losses is represented by connector, net and
battery agents. The agent that connects to the battery
net models losses associated with charging and dis-
charging. The battery agent models linear constraint
associated with its capacity.
This problem decomposition has been performed
to obtain an adequate representation of the energy net-
work such that individual subproblems are easy to
solve and yield meaningful solutions.
3.2 Optimization Problem
MAS addresses the problem of minimizing the en-
ergy bill at the connection point while satisfying en-
ergy balance constraints, physical constrains of de-
vices and comfort preferences. Using a splitting tech-
nique for the variables associated with net and device
agents the following multiagent optimization problem
is formulated
minimize
x
i
i
,z
i
Θ
i
iD
f
i
(x
i
) +
iN
g
i
(z
i
)
subject to x
i
= z
i
, i N
(1)
where f
i
is a real valued objective function associated
with the i-th device and defined in the feasible region
i
, g
i
is a real valued objective function associated
with the i-th net and defined in the feasible region Θ
i
,
x
i
and z
i
are the decision variables associated with the
i-th devices and net, respectively. The constraints ac-
count for the fact that respective device and net agents
should agree upon the values of shared variables.
Finding the minimizer to an equality constrained
optimization problem is equivalent to identifying the
saddle point of the associated Lagrangian function.
This gives the following augmented Lagrangian func-
tion
L(x,z,λ) =
iD
f
i
(x
i
)+
iN
g
i
(z
i
)+
ρ
2
iN
kx
i
z
i
+u
i
k
2
2
(2)
where u
i
= λ
i
/ρ is the scaled dual variable (for La-
grange multipliers λ
T
i
) , x
i
and z
i
are primal variables.
3.3 Agent Coordination
Agents solve their local problems in a coordination
with their neighbors. The coordination mechanism is
based on the alternating direction method of multipli-
ers (ADMM). ADMM iteratively minimizes the aug-
mented Lagrangian function (2) with respect to primal
and dual variables. Each iteration involves the follow-
ing steps.
Step 1. Device agents compute in parallel their opti-
mal variables by solving
x
(k+1)
iD
= argmin
x
i
i
f
i
(x
i
) +
ρ
2
kx
i
(z
k
i
u
k
i
)k
2
2
(3)
The corresponding values are communicated to
neighboring nets.
Step 2. Net agents compute in parallel their optimal
variables by solving
z
(k+1)
iN
= argmin
z
i
Θ
i
g
i
(z
i
) +
ρ
2
kz
i
(x
(k+1)
i
+ u
k
i
)k
2
2
(4)
Step 3. Net agents in parallel update their dual vari-
ables.
u
(k+1)
iN
= u
k
i
+ (x
(k+1)
i
z
(k+1)
i
) (5)
The corresponding primal and dual variables are sent
to neighboring devices.
The above steps are repeated until convergence
criteria are met. The convergence criteria are defined
locally for primal and dual residuals as
r
primal
< ε
primal
r
dual
< ε
dual
(6)
where ε
primal
,ε
dual
are small positive numbers repre-
senting primal and dual tolerances, respectively. The
primal and dual residuals are computed as
r
primal
= kx
k
i
z
k
i
k
2
r
dual
= kρ(z
k
i
z
k1
i
)k
2
(7)
If the device and net functions f (x) and g(z) are
convex, the constraint residual under ADMM is guar-
anteed to converge to zero and the objective value to
the minimum of the dual problem, see (Boyd et al.,
2011).
Multiagent System for Community Energy Management
31
3.4 Agent Models
3.4.1 Nets
The net agents (AGRNet, ENet, HNet and BNet) en-
sure the energy balance treating the constraints
iD
z
i
(τ) = 0, τ = 1,.. . ,H.
The problem (4) is solved by projecting the variables
received from neighboring devices onto the feasible
region as in (Kraning et al., 2014).
3.4.2 Devices
The C agent connects two nets. In each time step τ,
there two possible cases:
(i) the energy flows from net 1 to net 2, then
0 x
1
(τ) x
max
1
(τ) and η
1
· x
1
(τ) = x
2
(τ)
(ii) the energy flows from net 2 to net 1, then
0 x
2
(τ) x
max
2
(τ) and x
1
(τ) = η
2
· x
2
(τ)
where η
1
,η
2
(0,1] are transmission efficiencies.
The problem (3) is solved by finding critical points
for two cases and selecting the one with a lower value
of (3) in each time step τ. HP represents a particular
case when the energy flows only from ENet to HNet.
The ET agent is associated with the following ob-
jective function
f (x) =
H
τ=1
p
buying
(τ) · x
+
(τ) +
H
τ=1
p
selling
(τ) · x
(τ)
where p
buying
(τ) and p
selling
(τ) are respectively the
price of imported and exported energy, x
+
(τ) is the
energy with the positive sign (imported), and x
(τ)
is the energy with the negative sign (exported). The
set of constraints restrict the energy coming from and
into the grid.
x
min
x(τ) x
max
, τ = 1,... , H.
where x
min
(τ) and x
max
(τ) are respectively the min-
imum and the maximum energy flow allowed. The
problem (3) is solved by finding critical points for
positive and negative cases and selecting the one with
a lower value of (3). Constraints are treated by pro-
jection.
The FL and PV agents aim to satisfy respectively
the forecast consumption and production
x(τ) = ˆx(τ), τ = 1,... , H
where ˆx are forecast values. The solution to (3) is
trivial (x
k
= ˆx).
The B agent has a set of constraints aiming to keep
its state of charge as well as charging and discharging
rates within the allowed range.
Q
min
Q(τ) Q
max
, τ = 1,... , H
x
min
x(τ) x
max
, τ = 1,... , H
where Q
min
and Q
max
are the minimum and maximum
allowed charge of the battery, x
min
and x
max
are lim-
its for discharging and charging rates. The battery’s
charge evolves as (Kraning et al., 2014)
Q(τ) = Q
init
+
H
τ=1
x(τ)
where Q
init
is the initial charge of the battery.
The SH agent has a set of constraints to ensure a
room temperature is within the comfort temperature
limits.
T
min
T (τ) T
max
, τ = 1,... , H
where T
min
and T
max
are the temperature limits. The
room temperature evolves as (Kraning et al., 2014)
T (τ) = T (τ 1) +
µ
c
·
T
amb
(τ) T (τ 1)
+
+
η
c
· x(τ), τ = 1,.. . ,H
where T (0) is the initial temperature, T
amb
is the out-
door temperature, µ is the conduction coefficient, η
is the heating efficiency and c is the heat capacity of
indoor air.
The HWS agent has a set of constraints to ensure
the temperature of water inside the tank is within the
allowed range.
T
min
T (τ) T
max
, τ = 1,..., H
with T
min
and T
max
are the temperature limits. The
water temperature evolves as (Tasdighi et al., 2014)
T (τ) = T (τ 1) +
V
cold
(τ)
V
total
·
T
cold
T (τ 1)
+
+
1
V
total
· c
· x(τ), τ = 1,.. . ,H
where T (0) is the initial temperature, V
cold
is the vol-
ume of water with temperature T
cold
entering the tank
to replace the consumed hot water, V
total
is the tank
volume, and c is the specific heat of water. The con-
sumption of hot water is forecast.
The B, SH and HWS agents solve the problem (3)
using Dykstra’s projection method with a starting
point (z
k
u
k
).
ICAART 2020 - 12th International Conference on Agents and Artificial Intelligence
32
Table 2: Different market situations.
u
k
i
z
k
i
Market situation
Positive Positive Overconsumption/Underproduction: the market is proposing the prosumer to con-
sume the energy z
i
paying the price u
i
.
Positive Negative Overconsumption/Underproduction: the market is proposing the prosumer to pro-
duce the energy z
i
and get paid the price u
i
.
Negative Positive Underconsumption/Overproduction: the market is proposing the prosumer to con-
sume the energy z
i
and get paid the price u
i
.
Negative Negative Underconsumption/Overproduction: The market is proposing the prosumer to pro-
duce the energy z
i
paying the price u
i
.
3.5 Agent Negotiation
ADMM iteratively processes primal and dual vari-
ables of the augmented Lagrangian function. These
variables have a meaningful interpretation within the
energy network. The primal variables represent the
energy and the dual variables define its price in differ-
ent nodes across the network.
Agent interactions, governed by ADMM, model
a negotiation process where device agents negotiate
their energy exchange in exchange zones represented
by net agents. Messages sent from nets to devices rep-
resent requests. These messages contain the amount
of energy requested, z
k
i
. The sign is used to distin-
guish between production and consumption. From a
recipient perspective, a positive value indicates that
the energy flows towards the recipient, a negative
value indicates the flow towards the sender. It also
includes the price, u
k
i
, which not only indicates the
current market price, but also is used to distinguish
between a situation of overconsumption (in which the
price will be positive) and a situation of undercon-
sumption (in which the price will be negative).
Table 2 lists different market situations in ex-
change zones of energy network based on the sign of
the price and the requested power. The first two cases
(i.e. positive prices) refer to a market with underpro-
duction (i.e. overconsumption) situation. The last two
cases (i.e. negative prices) refer to a market with over-
production (i.e. underconsumption). In all cases, the
suggested payment is given by u
k
i
· z
k
i
.
The device agents send messages with offers as
response to received requests. This establishes the
precedence relation in agent communication meaning
that offer messages are only sent after request mes-
sages have been received and processed. An offer
message contains the amount of energy, x
k
i
, offered
by the device in each time interval.
The negotiation continues until the consensus is
reached between the agents. The device agents agree
on their energy profiles so that their variables are
equal to those requested by the nets. This situation
means the supply is equated to the demand in all the
exchange zones and the corresponding markets are
cleared.
4 RESULTS AND DISCUSSION
This section presents the results obtained by the de-
veloped MAS. The tests were performed using the
data for the winter season. Winter days are charac-
terized by the need to use heat pump for both heating
domestic hot water and maintaining room tempera-
ture within comfort limits. This represents the most
challenging optimization scenario as during other sea-
sons heat pump is only used for reheating domestic
hot water.
4.1 Optimizing Community Cost
Community members participate in community en-
ergy management having a common interest of in-
creasing social welfare through collective use of lo-
cal resources. This implies collaboration in terms of
energy use to reduce the cost at the connection point
when there is no external flexibility requests.
4.1.1 Day Ahead Optimization
Multiagent optimization suggests optimal energy us-
age for the next 24 hours discretized into 96 program
time units (PTUs) corresponding to 15 minute time
intervals. When running a day ahead optimization,
the system attempts to schedule energy consumption
for flexible loads to time intervals when renewable en-
ergy from solar panels is available. Starting optimiza-
tion at different time slots during the day changes the
perspective as the time horizon moves forward em-
bracing new time slots from the next day. Figure 3
provides insights about the effect of executing opti-
mization at different PTUs during the same day. The
figure shows the energy profiles of the community at
Multiagent System for Community Energy Management
33
Figure 3: Energy profiles of the community when optimization starts at 00:00 (left) and 12:00 (right).
Figure 4: SOC of the district battery when optimization starts at 00:00 (left) and 12:00 (right).
the connection point with the main grid. Positive val-
ues refer to the amount of energy taken from the grid
(imported energy). Negative values indicate the en-
ergy fed into the grid (exported energy). The plot on
the left shows results when optimization was executed
at midnight. The plot on the right refers to starting
time at midday which embraces the data for the fol-
lowing day.
The battery allows storing the excess of renewable
energy and later delivering this energy by discharging
when local demand is high. This is why the com-
munity does not import energy during evening hours.
The local demand is met by the energy released from
the battery. MAS schedules the district battery charg-
ing and discharging so that it takes locally produced
energy only in the amount needed to meet local de-
mand until the end of the time horizon. Figure 4 pro-
vides much insight about this process. The plots show
state of charge (SOC) with optimization starting at
different PTUs. It was considered that in the begin-
ning the battery had the lowest allowed SOC of 20%.
During the day the SOC is increased by injecting the
energy from solar PVs. Later this energy is released
to supply local demand. No extra energy is left or re-
leased for export. Without additional constraints for
optimization, this is the most effective strategy and
is as expected. Because the use of battery is always
associated with some costs due to charging and dis-
charging efficiencies, the battery should only be used
when that is really necessary.
4.1.2 Rolling Horizon Optimization
The method of applying optimization at every pro-
gram time unit is known as rolling horizon optimiza-
tion. Rolling horizon can mitigate uncertainties in the
models, such as forecast errors, and account for the
fact that the real time horizon is not limited to a sin-
gle day.
Figure 5 summarizes the results for rolling hori-
zon optimization. The effect of rolling horizon opti-
mization can be understood from Figure 5a. For com-
parison, this figure shows the community energy pro-
files obtained by day ahead and rolling horizon opti-
mizations. The former provides the results from the
single optimization run at the beginning of the day.
ICAART 2020 - 12th International Conference on Agents and Artificial Intelligence
34
(a) Energy profile of the community
(b) Energy profiles of heat pumps
(c) SOC of the district battery (d) Charging and discharging of the district battery
Figure 5: Results for rolling horizon optimization.
The latter involves the results of 96 optimizations dur-
ing the day, with the data for the first PTU being used
for control. The difference can be readily understood.
Rolling horizon optimization results in smaller energy
exports during times of intense electricity generation
from PV panels. This is explained by the fact that
rolling horizon accounts for time slots in the next days
with a need to meet local demand.
The day for which results are presented in Fig-
ure 5a is characterized by a massive production from
solar PVs panels. The optimized energy profiles sug-
gest peaks in times of high PV generation. This is
because no constraints on possible power flows were
imposed. In such scenario, the system solely focuses
on minimizing the energy bill of the community. Al-
though the results indicate that rolling horizon opti-
mization can reduce peaks to some extent, it is not
the goal of the community at this step. The issue of
dealing with possible grid overload is addressed in the
next section as part of congestion management sce-
narios.
The optimal behavior of the community is char-
acterized by shifting consumption of flexible devices
to time intervals with electricity available from solar
panels. This is because this electricity is cheaper than
the one taken from the main grid. Thus, both in-home
and district devices are expected to use energy in such
times during the day.
Heat pumps are flexible devices at the home level.
They are used to provide heat for both domestic hot
water and space heating. As expected, MAS sug-
gests using heat pumps in times with available renew-
able energy. This is shown in Figure 5b that depicts
a three-dimensional bar chart with the consumption
profiles of each heat pump in the community. It can be
seen that most of consumption occurs in times of high
PV generation. Consumption in other time intervals is
dictated by the need to satisfy temperature limits, es-
pecially for domestic hot water. The consumption of
domestic hot water is irregular with respect to time
and amount, especially in the evening.
Multiagent System for Community Energy Management
35
At the district level, there is a battery storage.
When multiagent optimization runs in a rolling hori-
zon mode, in the end of the day, the battery SOS is
not at its lower state because it holds some energy to
account for the following time horizon. This is shown
in Figure 5c that summarizes 96 optimization runs for
one day. Figure 5d graphically illustrates the con-
trol actions for the battery during the day in terms of
the amount of energy charged and discharged in each
PTU.
4.1.3 In-home vs Community Optimization
Community management should ensure its members
benefit from collective energy usage. To provide in-
sights about the advantages of community-based ap-
proach we compared the results of in-home and com-
munity optimizations. The former optimized commu-
nity households individually and combined their en-
ergy profiles. The latter performed the community
optimization. The results indicate the performance of
two approaches varies depending on the amount of re-
newable energy that is locally produced. Community-
based approach is better when there is excess of re-
newable energy. On the other hand, both approaches
perform similarly when it is low.
Figure 6 illustrates the amount of imported energy
for the two optimization approaches. It can be seen
that for all days community optimization yields less
or equal energy import as those of in-home optimiza-
tion. Similar results are only observed when PV gen-
eration is low. The analysis of the results indicates
that an increase in renewable energy generation leads
to a decrease in energy imported from the grid.
Table 3 further summarizes the obtained results.
During the period under consideration, the total re-
newable energy production was 9047.91 kWh. Sim-
ilarly to the above daily data, the total energy im-
port and export of the community was reduced. It is
important to note that besides economic benefits this
also reduces the stress on the main grid. Instead of
exporting the produced renewable energy it is used to
meet local demand.
Self-consumption is an important performance in-
dicator. It is defined as the ratio between the en-
ergy consumed and the total energy produced by
the community. As shown in Table 3, the com-
munity based optimization approach increases self-
consumption. These results provide important in-
sights about advantages of collective energy manage-
ment and the estimates of potential savings.
Figure 6: Comparing the energy import of the community
when using in-home optimization individually and commu-
nity optimization.
Table 3: Results for community optimization.
Optimization
In-home Community
Energy import (kWh) 16072.94 14384.53
Energy export (kWh) 3694.83 1814.42
Self-consumption (%) 59 80
4.2 Congestion Management
Power volatility caused by renewables and irregular
consumption poses significant challenges for the dis-
tribution grid. This volatility has the potential to lead
to network congestion, decreasing reliability. Con-
gestion management refers to avoiding the thermal
overload of system components by reducing loads.
Congestion occurs if the capacity of the grid is insuf-
ficient to accommodate the requested power flows.
This section presents and discusses the results of
addressing two different congestion management sce-
narios. In these scenarios, first the optimal com-
munity energy profiles were found by community
optimization without considering grid capacity con-
straints. Next, it was considered that a grid safety
analysis performed by a distribution system opera-
tor (DSO) required to limit the injected/consumed en-
ergy. The limits were introduced into the MAS in the
form of constraints. The resulting constrained opti-
mization problem was solved by multiagent optimiza-
tion to reschedule the energy use in the community.
4.2.1 Overproduction
The first considered congestion management scenario
refers to the situation in the grid with an excess of
injected renewable energy. This can readily occur in
sunny weather when local demand is low. Under such
ICAART 2020 - 12th International Conference on Agents and Artificial Intelligence
36
(a) maximum export 5kWh (b) maximum export 3kWh
Figure 7: Community energy profiles under congestion management scenarios due to overproduction.
circumstances, an increase in voltage can happen and
grid components can be damaged if no proper actions
are taken.
Figure 7 shows a day ahead scenario for the com-
munity addressing the oversupply of renewable en-
ergy. The energy profiles resulting from uncon-
strained community optimization are shown in blue.
The results obtained when addressing flexibility re-
quests from the DSO are shown in yellow. Two dif-
ferent requests limiting the energy injection are con-
sidered. These correspond to the maximum energy
injection of 5 kWh and 3 kWh per PTU. It can be
seen that both grid capacity limits are respected by the
MAS. The amount of renewable energy injected into
the main grid does not exceed the limits requested.
This is achieved by shifting the export from peak
sunny periods during the day to evening and night
hours. This reduces the stress on the distribution grid
and provides energy in times of high demand, such as
evening hours.
The availability of the storage capacity in the com-
munity is critical to exhibiting the above behavior.
The battery is able to take the excess of renewable
energy in peak times and later release it. Since the
community is interested in minimizing the cost and
maximizing the profit, the losses in the battery should
be minimized.
Figure 8 shows the behavior of community stor-
age in terms of energy charging and discharging in
this scenario. This figure illustrates that the more lim-
ited grid capacity, the more energy is taken in peak
times of PV production and correspondingly the more
energy released later. This results are as expected and
confirm the ability of MAS to adapt its energy export
according to grid conditions.
Figure 8: Charging and discharging of community storage
with different constraints limiting community export.
4.2.2 Overconsumption
The second considered congestion management sce-
nario involves the overload of grid components due to
high demand. This situation is common in times with
limited local production and high consumption.
Figure 9 depicts the community energy profiles
addressing these congestion management scenarios.
The plots show the results for requests limiting peak
consumption to 4 kWh and 3 kWh per PTU. For com-
parison, the plots also show results for community op-
timization without congestion constraints. Similarly
to previously considered scenario, these results sug-
gest that MAS is able to schedule the energy use for
the community under considered congestion manage-
ment scenarios.
The plots show that high demand occurs in
evening hours resulting in a peak consumption around
16:00. The requests from the DSO ask for lowering
this demand. To address this the community needs to
anticipate peak demand and to use the energy avail-
able in off-peak times. The more power reduction is
Multiagent System for Community Energy Management
37
(a) maximum import 4kWh (b) maximum import 3kWh
Figure 9: Community energy profiles under congestion management scenarios due to overconsumption.
Figure 10: Charging and discharging of community storage
with different constraints limiting community import.
Figure 11: Heat pumps consumption in the community with
different constraints limiting community import.
requested the more energy is consumed during off-
peak periods. This energy is taken by the commu-
nity battery storage when the local demand is low.
Later, during peak times, the stored energy is re-
leased. Thus, the community does not overload the
grid pulling energy in critical periods and meet its de-
mand by using the locally stored energy.
Figure 10 shows charging and discharging of com-
munity storage without and with congestion manage-
ment. Without congestion, no energy is injected. This
is because during the considered day there is no ex-
cess of renewable energy. All the energy generated by
rooftop panels is consumed locally. However, when
MAS takes into consideration DSO requests, the bat-
tery storage is utilized to charge in off-peak time in-
tervals and discharge later to meet peak demand.
The reduction in peak demand can also be ad-
dressed by shifting consumption of flexible loads.
Heat pumps are flexible loads in the considered com-
munity. Figure 11 shows the cumulative consump-
tion of heat pumps in the community. A shift in the
consumption from peak to off-peak periods can be
observed. This shift takes place alongside with the
use of battery storage. The energy consumed by heat
pumps can come from the battery and from the ex-
ported energy as long as constraints are respected.
Thus, the obtained results show that flexibility re-
quests from the DSO are met through efficient use
of flexible loads, which combines charging and dis-
charging of battery storage as well as shifting heat
pump consumption to anticipate a peak load.
5 CONCLUSIONS
This paper presented a multiagent system for a real-
world scenario of community energy management.
An appropriate multiagent model was developed con-
sidering electrical and heating networks. The agent
models were presented indicating solution methods
ICAART 2020 - 12th International Conference on Agents and Artificial Intelligence
38
for their subproblems.
The obtained results offered important insights
and provided the evidence for the validity of multia-
gent system approach. Single run of multiagent opti-
mization results in optimal control actions for all con-
trollable devices in the community. These are in the
form of consumed and/or injected energy as well as
temperature set points for thermal loads. The system
demonstrated the ability to offer solutions satisfying
all the constraints whenever feasible solutions exist.
These constraints involve allowed state of charge of
battery, temperature limits in each time unit and en-
ergy balance in each node of the network. The sug-
gested consumption profiles are meaningful. The en-
ergy consumption for flexible loads is scheduled in
times when renewable energy is available. The ex-
port of energy is scheduled so that local demand is
met first and only excess of local supply is fed into
the main grid.
As opposed to many existing studies in the liter-
ature that consider artificial case studies where the
number of prosumers and consumers are carefully se-
lected, the presented study involved a real-world com-
munity of households. These households have simi-
lar characteristics and are located in a close neighbor-
hood. As a result, rooftop solar panels produce renew-
able energy in same times during the day and in simi-
lar amounts. The consumption patterns of households
are also similar, which is due to social and economic
similarities of neighbors. Often, this leads to the situ-
ation when solar panels intensively produce electric-
ity virtually all households have the energy in excess.
In such times, the community has a surplus of cheap
energy and no local demand to use it. As a result, an
energy sharing mechanism is not fully appreciated by
community members. One possible way to address it
can be through considering more flexible loads. An-
other can be through encouraging households without
PV panels to join the community. Such new commu-
nity members would benefit from consuming the sur-
plus of local renewable energy. Importantly, house-
holds that are the energy producers will also be better
off due to differences in prices for export to the main
grid and for selling to community peers.
As future work, we will address the issue of a fair
distribution of costs and profits between community
members.
ACKNOWLEDGEMENTS
This research has received funding from the European
Union’s Horizon 2020 research and innovation pro-
gramme under grant agreement No 774431 (DRIvE).
REFERENCES
Boyd, S., Parikh, N., Chu, E., Peleato, B., and Eckstein, J.
(2011). Distributed optimization and statistical learn-
ing via the alternating direction method of multipliers.
Found. Trends Mach. Learn., 3(1):1–122.
Kantamneni, A., Brown, L. E., Parker, G., and Weaver,
W. W. (2015). Survey of multi-agent systems for mi-
crogrid control. Engineering Applications of Artificial
Intelligence, 45:192–203.
Kraning, M., Chu, E., Lavaei, J., and Boyd, S. (2014). Dy-
namic network energy management via proximal mes-
sage passing. Found. Trends Optim., 1(2):73–126.
Lilliu, F., Vinyals, M., Denysiuk, R., and Recupero, D. R.
(2019). A novel payment scheme for trading renew-
able energy in smart grid. In Proceedings of the Tenth
ACM International Conference on Future Energy Sys-
tems, e-Energy ’19, pages 111–115.
Long, C., Wu, J., Zhou, Y., and Jenkins, N. (2018). Peer-to-
peer energy sharing through a two-stage aggregated
battery control in a community microgrid. Applied
Energy, 226:261–276.
Mihaylov, M., Jurado, S., Avellana, N., Van Moffaert, K.,
de Abril, I. M., and Now
´
e, A. (2014). Nrgcoin: Vir-
tual currency for trading of renewable energy in smart
grids. In 11th International Conference on the Euro-
pean Energy Market, pages 1–6.
Paola, A. D., Angeli, D., and Strbac, G. (2017). Price-
based schemes for distributed coordination of flexible
demand in the electricity market. IEEE Transactions
on Smart Grid, 8:3104–3116.
Shamsi, P., Xie, H., Longe, A., and Joo, J. (2016). Eco-
nomic dispatch for an agent-based community micro-
grid. IEEE Trans Smart Grid, 7(5):2317–24.
Sousa, T., Soares, T., Pinson, P., Moret, F., Baroche, T., and
Sorin, E. (2019). Peer-to-peer and community-based
markets: A comprehensive review. Renewable and
Sustainable Energy Reviews, 104:367 – 378.
Tasdighi, M., Ghasemi, H., and Rahimi-Kian, A. (2014).
Residential microgrid scheduling based on smart me-
ters data and temperature dependent thermal load
modeling. IEEE Transactions on Smart Grid, 5:349–
357.
Vinyals, M., Velay, M., and Sisinni, M. (2018). A multi-
agent system for energy trading between prosumers.
In 14th International Conference on Distributed Com-
puting and Artificial Intelligence, pages 79–86.
Yang, P. and Nehorai, A. (2014). Joint optimization of hy-
brid energy storage and generation capacity with re-
newable energy. IEEE Transactions on Smart Grid,
5(4):1566–1574.
Multiagent System for Community Energy Management
39