  Following recent Danish legislation promoting energy communities, we explore
how to enable these communities to provide grid services to distribution system
operators. In particular, we focus on "capacity limitation services", where we
propose a bilateral agreement in which an energy community is given reduced
grid import tariffs by setting a cap to its consumption level in certain hours.
This requires a coordination mechanism between the community manager and the
prosumers within the community. We enable this coordination by developing a
bilevel optimization model to be solved by the community manager, aiming to set
dynamic, i.e., time- and prosumer-differentiated, prices. This coordination
mechanism enabled by dynamic pricing ensures desirable market properties
including budget balance for the community manager and individual rationality
for prosumers, while encouraging (but not guaranteeing) a fair allocation of
collected benefits among prosumers.
