Optimal Sizing and Control of a Grid-Connected Battery in a Stacked Revenue Model Including an Energy Community