European climate polices acknowledge the role that energy communities can play in the energy transition. Self-consumption installations shared among those living in the same building are a good example of such energy communities. In this work, a regional analysis of optimal self-consumption installations under the new legal framework recently passed in Spain is performed. Results show that the optimal sizing of the installation leads to economic savings for self-consumers in all the territory, for both options with and without remuneration for energy surplus. A sensitivity analysis on technology costs revealed that batteries still require noticeably cost reductions to be cost-effective in a behind the meter self-consumption environment. In addition, solar compensation mechanisms make batteries less attractive in a scenario of low PV costs, since feeding PV surplus into the grid, yet less efficient, becomes more cost-effective. An improvement for the energy surplus remuneration policy in the context of the current legislation was proposed and analysed. It consists in the inclusion of the economic value of the avoided power losses in the remuneration.