Optimization of Battery Energy Storage Systems for Prosumers and Energy Communities Under Capacity-Based Tariffs | Synapse