Efficient Sampling for Data-Driven Frequency Stability Constraint via Forward-Mode Automatic Differentiation
Wangkun Xu, Qian Chen, Pudong Ge, Zhongda Chu, Fei Teng
TL;DR
The paper addresses the challenge of encoding frequency stability constraints in power-system operation under nonlinear dynamics, where data-driven models require high-quality training data and random sampling is inefficient. It introduces a gradient-based data-generation method using forward-mode automatic differentiation (FMAD) by augmenting the ODE with tangent states to compute $\partial x(t)/\partial \theta$ in a single solve, and employs gradient surgery to reconcile competing stability criteria ($t_{rocof}$, $t_{ss}$, $t_{nadir}$). The approach is shown to be more memory-efficient than unrolling AD and more robust than finite differences, effectively producing boundary-focused samples across case studies. This enables efficient construction of labeled datasets for data-driven frequency stability constraints in online optimization, with code made publicly available for reproducibility and reuse.
Abstract
Encoding frequency stability constraints in the operation problem is challenging due to its complex dynamics. Recently, data-driven approaches have been proposed to learn the stability criteria offline with the trained model embedded as a constraint of online optimization. However, random sampling of stationary operation points is less efficient in generating balanced stable and unstable samples. Meanwhile, the performance of such a model is strongly dependent on the quality of the training dataset. Observing this research gap, we propose a gradient-based data generation method via forward-mode automatic differentiation. In this method, the original dynamic system is augmented with new states that represent the dynamic of sensitivities of the original states, which can be solved by invoking any ODE solver for a single time. To compensate for the contradiction between the gradient of various frequency stability criteria, gradient surgery is proposed by projecting the gradient on the normal plane of the other. In the end, we demonstrate the superior performance of the proposed sampling algorithm, compared with the unrolling differentiation and finite difference. All codes are available at https://github.com/xuwkk/frequency_sample_ad.
