Combining Federated Learning and Risk-Aware Optimization for Privacy-Preserving Coordination of Energy Communities in Flexibility Markets: Unlocking Flexibility from Smart Households and Electric Vehicle Fleets
Energy communities can provide valuable demand-side flexibility to distribution systems, yet their effective participation in flexibility markets remains constrained by two closely related challenges: uncertainty in the flexibility that can actually be delivered and the privacy-sensitive nature of end-user operational data. This paper proposes a privacy-preserving and risk-aware methodology that supports the integration of energy communities into intraday flexibility markets by linking decentralized uncertainty forecasting with market participation and ex-post delivery assessment. The proposed framework consists of four stages: federated probabilistic forecasting of community load components, flexibility estimation and risk-aware bid formation, distribution-level flexibility market clearing under network security constraints, and chronological out-of-sample backtesting with shortfall settlement. At the forecasting stage, an improved quantile gated recurrent unit (iQGRU)-based federated probabilistic model with Huber pinball loss and pseudo-gradient averaging is used to improve uncertainty characterization across heterogeneous communities without sharing raw end-user operational data. The resulting quantile forecasts are then explicitly translated into risk-aware flexibility bids, allowing forecast uncertainty to directly inform bidding decisions. The framework is tested on a 594-bus distribution network in Victoria, Australia, with 27 participating energy communities and residential portfolios comprising thermostatically controlled loads (TCLs) and electric vehicle (EV) chargers. The results confirm that the proposed methodology improves both forecasting quality and market performance. Compared with local training, federated training reduces median forecast error by 9.91%, increases delivered flexibility by 1.96%, and lowers non-delivery penalty costs by 9.92%. Risk-aware bidding further improves the delivery ratio by 3.54%, while expanding the residential flexibility portfolio increases delivered flexibility and net community benefit and reduces reliance on upstream-network flexibility procurement by 38.37%. Overall, the proposed methodology helps translate residential flexibility into a more credible and market-deliverable service.