  Renewable energy communities are legal entities involving the association of
citizens, organizations and local businesses aimed at contributing to the green
energy transition and providing social, environmental and economic benefits to
their members. This goal is pursued through the cooperative efforts of the
community actors and by increasing the local energy self-consumption. In this
paper, the optimal energy community operation in the presence of energy storage
units is addressed. By exploiting the flexibility provided by the storage
facilities, the main task is to minimize the community energy bill by taking
advantage of incentives related to local self-consumption. Optimality
conditions are derived, and an explicit optimal solution is devised. Numerical
simulations are provided to assess the performance of the proposed solution.
