A two-stage decision system based on distributed optimization in energy communities | Synapse