Abstract
Frequency stability becomes more and more important with the increase in inverter-based resources in power systems. To enhance the frequency stability, this paper proposes a novel data-driven method for frequency stability assessment and control for energy storage systems (ESSs). Leveraging the neural ordinary differential Equation (ODE) framework, the method learns a continuous-time model of the system frequency dynamics. A neural-network-based controller is then designed according to the learned neural ODE model to enhance frequency stability. The training process involves an alternating optimization algorithm that updates both the neural ODE model and the controller parameters via the adjoint sensitivity method. Simulation results demonstrate that the proposed method accurately predicts frequency trajectories. Moreover, the designed controller reduces frequency deviation by 53%.
1. Introduction
A high penetration of inverter-based resources (IBRs), including renewable energy sources (RESs), energy storage systems (ESSs), high-voltage DC transmission systems, etc., has introduced more complexity into the power system. Due to the lack of physical inertia and damping compared with thermal synchronous generators, IBRs pose a significant impact to the frequency stability of power systems [1]. Moreover, uncertainty and fluctuation of RESs further cause large frequency deviation and oscillation [2]. Hence, it is necessary to build an accurate power system dynamics model and improve the ability of the frequency stability assessment and control.
It requires the frequency stability assessment to judge the reliability of power systems. Some methods output the decision-making results directly according to the system measurement [3], while other methods build the frequency dynamics model and evaluate the system stability indirectly [4]. Existing methods for the frequency stability assessment can be commonly divided into model-based methods and data-driven methods, as shown in Table 1. Model-based methods depend on the mathematical modeling or physical mechanism of power systems. The common model-based method is to build the models of the speed governor and the prime mover of the generating unit [5], but it is not suitable for inverter-dominated power systems that include many IBRs with various response characteristics. Reference [6] builds a state–space frequency prediction equation of voltage source converters and further designs a model predictive controller for fast frequency response. However, the tradeoff between accuracy and efficiency limits the application of the model-based method in power systems, as the accuracy usually depends on complex modeling that needs more computation resources [4].
The data-driven methods include statistical analysis [7], system identification [8], decision-tree learning [9], support vector machines (SVM) [10], etc. Recently, deep learning has achieved significant success in many research fields. Deep learning appears to be a promising method for predicting frequency dynamics and stability analysis, which can reduce online computational burden by learning historical data offline. In [11], an extreme learning machine method is utilized to design a stability assessment model considering various system topologies. In [12], a deep belief network (DBN)-based nonlinear representation learning method is proposed to assess the stability according to the power flow and voltage measurement. Reference [13] uses deep Koopman-based inference network to learn the power system dynamics and model predictive control (MPC) to enhance frequency stability.
The assessment method that learns the system dynamics is more beneficial for controller design. However, typical neural networks can only learn discrete-time dynamics. The discretization step size decides the accuracy of the assessment method, resulting in a tradeoff between accuracy and computational cost. Recently, neural ordinary differential Equation (ODE) models [14] have demonstrated the ability to model continuous-time systems, which provides an approach for solving continuous-time control tasks efficiently and accurately.
Table 1.
Comparison of frequency stability assessment methods.
Table 1.
Comparison of frequency stability assessment methods.
| Category | Method | Modeling Approach |
|---|---|---|
| Model-based methods | State–space model [6], physical modeling [5], etc. | Physics-based equations |
| Data-driven methods | Decision tree [9], SVM [10], DBN [12], etc. | Discrete-time black-box models |
| Hybrid methods | Model and data-driven [4] | Partial modeling and data completion |
Currently, using neural controllers is a dominant approach in reinforcement learning [15], relying on the universal approximation capacity of neural networks [16]. However, the RL training usually requires lots of trajectory samplings to estimate the objective to be optimized. If the system dynamics is known, it is possible to optimize the controller efficiently based on an optimal control method [17].
To this end, this paper proposes a neural ODE-based frequency stability assessment and control method for ESSs. First, two neural networks are utilized to build the frequency dynamics model and frequency controller, respectively. Then, the frequency dynamics model can learn the true dynamics of the system through the ODE solver and adjoint method. Further, the frequency dynamics model is used to evaluate the performance of the neural controller, which provides optimization direction to update the controller. Thereafter, an alternative optimization algorithm for the neural ODE model and the controller is designed to improve the performance of the frequency stability assessment and control.
2. Methodology
The framework of the proposed method is shown in Figure 1. The primary control of the ESS consists of the active power control (APC) and the reactive power control (RPC). The APC regulates the active power output through changing the power angle of the ESS, while the RPC regulates the reactive power through changing the voltage magnitude. The proposed method learns the frequency dynamics of the ESS and regulates APC to enhance frequency stability.
Figure 1.
The framework of the proposed method.
2.1. Frequency Stability Assessment
The APC of the ESS based on a typical virtual synchronous generator method can be expressed as
where is the angle difference between the converter and the power grid, is the frequency deviation, u is the control input to provide additional frequency response, H, D, P and are the emulated inertia, damping coefficient, active power reference and active power output, respectively. The above model is decided by the control law of the converter and does not consider the response of the converter. Hence, we use the neural ODE method [14] to learn the system frequency dynamics:
where represents the state and d represents the system disturbance, including the change in the active power reference and load.
A neural ODE model parameterized by is designed to approximate f. If the system sampling period , the optimization problem of the model is as follows:
where is the measured state from the system at time step k. In practice, the estimated state is the result of an ODE solver, so the main challenge in solving the problem (4) and (5) is performing the backpropagation through the ODE solver, which requires the gradients with respect to . The backpropagation of the neural ODE is achieved by the adjoint method. Define the adjoint and its dynamics:
The adjoint can be solved by the ODE solver with the initial value . According to the adjoint sensitivity method, the gradient with respect to the parameters is
As a result, the gradient of L with respect to the parameter can be obtained by the chain rule
Hence, the parameter can be adjusted by the gradient (8) to minimize the objective (4).
After the training, the frequency dynamics can be predicted by the neural ODE model to assess the frequency stability when changing the active power reference or occurring load disturbances. To predict the frequency response under the load disturbances, it is necessary to measure the disturbance signal previously. According to the relationship between the maximum RoCoF and the disturbance, the disturbance magnitude can be estimated by [18]. The maximum RoCoF is measured at the instant of frequency change, before any control input is implemented.
2.2. Neural Frequency Control
To further reduce the frequency deviation, a neural controller parameterized by is designed to decide the control input u. Hence, the frequency dynamics can be predicted by a coupled neural ODE model:
The control objective is to minimize the frequency deviation:
where Q and R are the state cost matrix and control cost matrix, respectively. Similarly to the optimization method for problem (4) and (5), the gradient of J with respect to the parameter is
Hence, the controller can be updated by the gradient (11).
In the frequency control task, the control input u can not affect the steady state of the system, i.e., when the system frequency deviation . To satisfy the condition, each layer of the neural controller has no biases and uses the tanh activation function.
2.3. Algorithm
The neural ODE model and the controller are optimized alternately. The accuracy of the model determines the effectiveness of the controller optimization. Hence, it is necessary to update the model first according to the real trajectories. On the other hand, the controller may change the distribution of the state space, thus the neural ODE model needs to be trained again. As the controller is optimized, the model still needs to be further updated. Overall, the optimization method is as shown in Algorithm 1.
In each epoch, the algorithm collects the trajectory in I episodes and then updates the neural ODE model and controller. The number of episodes I is chosen to provide a sufficiently large dataset to optimize the model. The length of each episode N allows the model to capture the complete dynamics, which should be large enough. The learning rates for the model and controller should be relatively small to ensure stable convergence.
| Algorithm 1 Optimizing neural ODE model and controller |
| Input: Power system environment f; Output: Parameters of neural ODE model and ; 1: Initialize the parameters and ; 2: for epoch do 3: for episode do 4: Obtain the initial state and system disturbance d; 5: for do 6: Execute control input ; 7: Observe the next state ; 8: end for 9: Store the trajectory in the buffer; 10: end for 11: for do 12: Sampling a trajectory from buffer; 13: Predict the trajectory through with the inital value ; 14: Compute the loss function L; 15: Compute the gradient ; 16: ; 17: end for 18: for do 19: Predict the trajectory through with the inital value ; 20: Compute the objective function J; 21: Compute the gradient ; 22: ; 23: end for 24: end for |
3. Simulation Results
The proposed method is validated on the ESS connected with an infinite bus. The ESS implements the virtual synchronous generator control method as shown in Equation (1), where and . The ODE model is employed with four hidden layers consisting of 50 neurons each and a controller with one hidden layer consisting of 50 neurons. All hidden layers use the tanh activation function.
To train the model in Algorithm 1, the number of episodes I and the length of each episode N are set as 100 and 60, respectively. The length of each episode is large enough to capture complete frequency dynamics. Satisfactory control performance is achieved in two epochs of the alternative training. The state cost matrix Q and control cost matrix R are set as and , respectively.
The step lengths and are all set as . The sampling period is s. The real trajectories of the power system environment are obtained from the simulation in Python 3.11 and Andes [19], a software for symbolic power system modeling and numerical analysis.
To improve the training efficiency of the algorithm, the neural ODE model is initialized by the trajectories without controllers. The system dynamics data is collected to train the neural ODE model. The loss function L through the training is shown in Figure 2. It can be seen that the training error of the neural ODE model decreases gradually.
Figure 2.
Training loss of the neural ODE model.
After the initialization, the trajectories of the ESS under two different cases are collected. The first case is to regulate the active power references from 0 to 1 p.u., and the other case is 1 p.u. step load increase. The true trajectories are compared with the predicted trajectories by the model . Figure 3a illustrates the system dynamics when regulating the active power references at s. The neural ODE model can predict the system dynamics accurately, which can be utilized to evaluate the frequency nadir and RoCoF before regulating the output power of ESS. Figure 3b illustrates the system dynamics in the case of the step load increase occurring at s. There exists a certain approximate error, which may be caused by the inaccurate load disturbance estimation.
Figure 3.
The trajectory of the ESS under different cases. (a) regulating the active power reference from 0 to 1 p.u. (b) 1 p.u. step load increase.
To illustrate the optimization process, the control performance of the controller at the end of each epoch is tested. At s, the active power reference of the ESS is adjusted from 0 to 1 p.u. The frequency and control input response after each epoch are shown in Figure 4 and Figure 5. Comparing Figure 4 and Figure 5, the controller reduces the frequency deviation and suppresses overshoot of the active power output of the ESS effectively. In addition, the neural ODE still predicts frequency dynamics well. In Figure 5b, it can be seen that the controller is further optimized and the frequency deviation becomes smaller.
Figure 4.
The frequency and active power output of the ESS when regulating the active power reference from 0 to 1 p.u.
Figure 5.
The frequency, active power output and control input of the ESS under the controller. (a) The optimized controller after epoch 1. (b) The optimized controller after epoch 2.
The frequency dynamics and control performance when occurring 1 p.u. step load increase are tested in the simulation. The control performance of the MPC-based method [12] and the proposed method is evaluated by the integral absolute error and nadir of the frequency deviation in Table 2. It can be seen that the proposed method achieves the smallest frequency deviation and nadir. As shown in Figure 6, the frequency deviation is reduced by the optimized controller, which demonstrates the effectiveness of the proposed method.
Table 2.
Comparisons of control performance.
Figure 6.
The frequency and control input of the ESS under different controllers in the case of 1 p.u. step load increase.
4. Conclusions
This paper has presented a neural ODE-based framework for frequency stability assessment and control of ESSs. The proposed method predicts the frequency dynamics accurately and provides the reference model for the controller optimization. The optimized controller reduces the frequency deviation and oscillation effectively. The effectiveness of the proposed method lies in the combination of the neural ODE model with the neural controller. In the proposed framework, an alternative training algorithm for the neural ODE model and controller is designed to reduce the prediction error of the system frequency and improve the control performance. The proposed algorithm is tested on the simulation to validate its outstanding performance.
Future work should include building neural stochastic ODEs to improve the robustness of the controller and neural differential algebraic equations for large power systems.
Author Contributions
Conceptualization, S.G. and E.L.; methodology, S.G.; software, S.G. and E.L.; validation, S.G. and E.L.; formal analysis, E.L.; investigation, J.L. and E.L.; resources, J.L.; data curation, Z.W.; writing—original draft preparation, J.L.; writing—review and editing, Z.W.; visualization, Z.W.; supervision, S.G.; project administration, E.L. and M.Z.; funding acquisition, S.G. and M.Z. All authors have read and agreed to the published version of the manuscript.
Funding
This work was funded by the Science and Technology Project of State Grid Shandong Electric Power Research Institute “Research and Application of Collaborative Control Technology for Multi-type Energy Storage and Temporal Complementarity” (No. 52062624000U).
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Data are contained within the article.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Hatziargyriou, N.; Milanovic, J.; Rahmann, C.; Ajjarapu, V.; Canizares, C.; Erlich, I.; Hill, D.; Hiskens, I.; Kamwa, I.; Pal, B.; et al. Definition and classification of power system stability–revisited & extended. IEEE Trans. Power Syst. 2020, 36, 3271–3281. [Google Scholar]
- Zhang, Y.; Wu, S.; Lin, J.; Wu, Q.; Shen, C.; Liu, F. Frequency reserve allocation of large-scale RES considering decision-dependent uncertainties. IEEE Trans. Sustain. Energy 2023, 15, 339–354. [Google Scholar] [CrossRef]
- Hu, W.; Lu, Z.; Wu, S.; Zhang, W.; Dong, Y.; Yu, R.; Liu, B. Real-time transient stability assessment in power system based on improved SVM. J. Mod. Power Syst. Clean Energy 2019, 7, 26–37. [Google Scholar] [CrossRef]
- Wang, Q.; Li, F.; Tang, Y.; Xu, Y. Integrating model-driven and data-driven methods for power system frequency stability assessment and control. IEEE Trans. Power Syst. 2019, 34, 4557–4568. [Google Scholar] [CrossRef]
- Egido, I.; Fernandez-Bernal, F.; Centeno, P.; Rouco, L. Maximum frequency deviation calculation in small isolated power systems. IEEE Trans. Power Syst. 2009, 24, 1731–1738. [Google Scholar] [CrossRef]
- Stanojev, O.; Markovic, U.; Aristidou, P.; Hug, G.; Callaway, D.; Vrettos, E. MPC-based fast frequency control of voltage source converters in low-inertia power systems. IEEE Trans. Power Syst. 2020, 37, 3209–3220. [Google Scholar] [CrossRef]
- Zhang, Y.; Xu, Y.; Dong, Z.Y. Robust ensemble data analytics for incomplete PMU measurements-based power system stability assessment. IEEE Trans. Power Syst. 2017, 33, 1124–1126. [Google Scholar] [CrossRef]
- Conte, F.; Massucco, S.; Paolone, M.; Schiapparelli, G.P.; Silvestro, F.; Zuo, Y. Frequency stability assessment of modern power systems: Models definition and parameters identification. Sustain. Energy Grids Netw. 2020, 23, 100384. [Google Scholar] [CrossRef]
- He, M.; Zhang, J.; Vittal, V. Robust online dynamic security assessment using adaptive ensemble decision-tree learning. IEEE Trans. Power Syst. 2013, 28, 4089–4098. [Google Scholar] [CrossRef]
- Baltas, N.G.; Mazidi, P.; Ma, J.; de Asis Fernandez, F.; Rodriguez, P. A comparative analysis of decision trees, support vector machines and artificial neural networks for on-line transient stability assessment. In Proceedings of the 2018 International Conference on Smart Energy Systems and Technologies (SEST), Sevilla, Spain, 10–12 September 2018; pp. 1–6. [Google Scholar]
- Liu, R.; Verbič, G.; Xu, Y. A new reliability-driven intelligent system for power system dynamic security assessment. In Proceedings of the 2017 Australasian Universities Power Engineering Conference (AUPEC), Melbourne, Australia, 19–22 November 2017; pp. 1–6. [Google Scholar]
- Zheng, L.; Hu, W.; Zhou, Y.; Min, Y.; Xu, X.; Wang, C.; Yu, R. Deep belief network based nonlinear representation learning for transient stability assessment. In Proceedings of the 2017 IEEE Power & Energy Society General Meeting, Chicago, IL, USA, 16–20 July 2017; pp. 1–5. [Google Scholar]
- Zhao, T.; Yue, M.; Wang, J. Deep-learning-based Koopman modeling for online control synthesis of nonlinear power system transient dynamics. IEEE Trans. Ind. Inform. 2023, 19, 10444–10453. [Google Scholar] [CrossRef]
- Chen, R.T.; Rubanova, Y.; Bettencourt, J.; Duvenaud, D.K. Neural ordinary differential equations. Adv. Neural Inf. Process. Syst. 2018, 31. [Google Scholar]
- Buşoniu, L.; De Bruin, T.; Tolić, D.; Kober, J.; Palunko, I. Reinforcement learning for control: Performance, stability, and deep approximators. Annu. Rev. Control. 2018, 46, 8–28. [Google Scholar] [CrossRef]
- Schmidhuber, J. Deep learning in neural networks: An overview. Neural Netw. 2015, 61, 85–117. [Google Scholar] [CrossRef] [PubMed]
- Ainsworth, S.; Lowrey, K.; Thickstun, J.; Harchaoui, Z.; Srinivasa, S. Faster policy learning with continuous-time gradients. In Proceedings of the Learning for Dynamics and Control, Online, 7–8 June 2021; pp. 1054–1067. [Google Scholar]
- Markovic, U.; Chu, Z.; Aristidou, P.; Hug, G. LQR-based adaptive virtual synchronous machine for power systems with high inverter penetration. IEEE Trans. Sustain. Energy 2018, 10, 1501–1512. [Google Scholar] [CrossRef]
- Cui, H.; Li, F.; Tomsovic, K. Hybrid symbolic-numeric framework for power system modeling and analysis. IEEE Trans. Power Syst. 2020, 36, 1373–1384. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).