Next Article in Journal
Preliminary Effects of a Robot-Based Therapy Program with Atlas-2030 in Children with Cerebral Palsy Receiving Care at a Specialized Rehabilitation Center
Previous Article in Journal
LSTM-Based Neural Network Controllers as Drop-In Replacements for PI Controllers in a Wastewater Treatment Plant
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Neural ODE-Based Frequency Stability Assessment and Control of Energy Storage Systems

1
State Grid Shandong Electric Power Research Institute, Jinan 250003, China
2
School of Cyber Science and Engineering, Xi’an Jiaotong University, Xi’an 710049, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2025, 15(22), 12048; https://doi.org/10.3390/app152212048
Submission received: 2 October 2025 / Revised: 3 November 2025 / Accepted: 8 November 2025 / Published: 12 November 2025
(This article belongs to the Section Computing and Artificial Intelligence)

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.
CategoryMethodModeling Approach
Model-based methodsState–space model [6], physical modeling [5], etc.Physics-based equations
Data-driven methodsDecision tree [9], SVM [10], DBN [12], etc.Discrete-time black-box models
Hybrid methodsModel 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.
The rest of this paper is organized as follows. Section 2 describes the proposed method for the frequency stability assessment and control. Section 3 presents the simulation results of the proposed method. Finally, the paper concludes in Section 4.

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.

2.1. Frequency Stability Assessment

The APC of the ESS based on a typical virtual synchronous generator method can be expressed as
δ ˙ = ω
2 H ω ˙ = D ω + P P e + u ,
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 P e 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:
x ˙ = f ( x , u , d ) ,
where x = [ δ , ω ] represents the state and d represents the system disturbance, including the change in the active power reference and load.
A neural ODE model f θ parameterized by θ is designed to approximate f. If the system sampling period T s , the optimization problem of the model is as follows:
min θ L = k = 0 N x ( k T s ) y k
s . t x ( k T s ) = x ( 0 ) + 0 k T s f θ ( x ( t ) , u ( t ) , d ) d t ,
where y k 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 a ( t ) and its dynamics:
a ˙ ( t ) = a ( t ) f θ ( x ( t ) , u ( t ) , d ) x .
The adjoint can be solved by the ODE solver with the initial value a ( k T s ) = x ( k T s ) / x ( k T s ) = 1 . According to the adjoint sensitivity method, the gradient with respect to the parameters θ is
d x ( k T s ) d θ = k T s 0 a ( t ) f θ ( x ( t ) , u ( t ) , d ) θ d t .
As a result, the gradient of L with respect to the parameter θ can be obtained by the chain rule
d L d θ = k = 0 N d L d x ( k T s ) d x ( k T s ) d θ .
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 f θ 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 ω ˙ m a x and the disturbance, the disturbance magnitude can be estimated by ω ˙ m a x = d / 2 H [18]. The maximum RoCoF ω ˙ m a x 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 u ρ ( x ) parameterized by ρ is designed to decide the control input u. Hence, the frequency dynamics can be predicted by a coupled neural ODE model:
x ˙ = f θ ( x , u ρ ( x ) , d ) .
The control objective is to minimize the frequency deviation:
min ρ J = k = 0 N T s ( x ( k T s ) Q + u ( k T s ) R ) ,
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
d L d ρ = k = 0 N d J d x ( k T s ) d x ( k T s ) d ρ
d x ( k T s ) d ρ = k T s 0 a ( t ) f θ ( x ( t ) , u ρ ( x ) , d ) ρ d t .
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.,  u = 0 when the system frequency deviation ω = 0 . 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 f θ and the controller u ρ are optimized alternately. The accuracy of the model f θ determines the effectiveness of the controller optimization. Hence, it is necessary to update the model f θ 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 u ρ is optimized, the model f θ 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 = 1 : E  do
  3:       for episode = 1 : I  do
  4:             Obtain the initial state y 0 and system disturbance d;
  5:             for  k = 0 : N  do
  6:                   Execute control input u = u ρ ( y k ) ;
  7:                   Observe the next state y k + 1 ;
  8:             end for
  9:             Store the trajectory [ y 0 , . . , y N ] in the buffer;
10:       end for
11:      for  i = 0 : I  do
12:             Sampling a trajectory [ y 0 , . . , y N ] from buffer;
13:             Predict the trajectory x ( k T s ) through f θ with the inital value x ( 0 ) = y 0 ;
14:             Compute the loss function L;
15:             Compute the gradient g 1 = d L / d θ ;
16:              θ θ α 1 g 1 ;
17:      end for
18:      for  i = 0 : I  do
19:             Predict the trajectory x ( k T s ) through f θ with the inital value x ( 0 ) = y 0 ;
20:             Compute the objective function J;
21:            Compute the gradient g 2 = d x ( k T s ) / d ρ ;
22:             ρ ρ α 2 g 2 ;
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 H = 4 and D = 40 . The ODE model f θ is employed with four hidden layers consisting of 50 neurons each and a controller u ρ 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 [ 0 , 0 ; 0 , 1 ] and 0.01 , respectively.
The step lengths α 1 and α 2 are all set as 0.003 . The sampling period T s is 1 / 30 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.
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 f θ . Figure 3a illustrates the system dynamics when regulating the active power references at t = 0 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 t = 0 s. There exists a certain approximate error, which may be caused by the inaccurate load disturbance estimation.
To illustrate the optimization process, the control performance of the controller u ρ at the end of each epoch is tested. At t = 0 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.
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.

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

  1. 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]
  2. 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]
  3. 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]
  4. 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]
  5. 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]
  6. 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]
  7. 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]
  8. 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]
  9. 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]
  10. 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]
  11. 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]
  12. 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]
  13. 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]
  14. Chen, R.T.; Rubanova, Y.; Bettencourt, J.; Duvenaud, D.K. Neural ordinary differential equations. Adv. Neural Inf. Process. Syst. 2018, 31. [Google Scholar]
  15. 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]
  16. Schmidhuber, J. Deep learning in neural networks: An overview. Neural Netw. 2015, 61, 85–117. [Google Scholar] [CrossRef] [PubMed]
  17. 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]
  18. 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]
  19. 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]
Figure 1. The framework of the proposed method.
Figure 1. The framework of the proposed method.
Applsci 15 12048 g001
Figure 2. Training loss of the neural ODE model.
Figure 2. Training loss of the neural ODE model.
Applsci 15 12048 g002
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.
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.
Applsci 15 12048 g003
Figure 4. The frequency and active power output of the ESS when regulating the active power reference from 0 to 1 p.u.
Figure 4. The frequency and active power output of the ESS when regulating the active power reference from 0 to 1 p.u.
Applsci 15 12048 g004
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.
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.
Applsci 15 12048 g005
Figure 6. The frequency and control input of the ESS under different controllers in the case of 1 p.u. step load increase.
Figure 6. The frequency and control input of the ESS under different controllers in the case of 1 p.u. step load increase.
Applsci 15 12048 g006
Table 2. Comparisons of control performance.
Table 2. Comparisons of control performance.
ControllerIAE (Hz)Nadir (Hz)
MPC [12]0.0356−0.1670
Proposed0.0314−0.1127
w/o control0.1019−0.2392
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.

Share and Cite

MDPI and ACS Style

Gao, S.; Liu, E.; Wu, Z.; Li, J.; Zhang, M. Neural ODE-Based Frequency Stability Assessment and Control of Energy Storage Systems. Appl. Sci. 2025, 15, 12048. https://doi.org/10.3390/app152212048

AMA Style

Gao S, Liu E, Wu Z, Li J, Zhang M. Neural ODE-Based Frequency Stability Assessment and Control of Energy Storage Systems. Applied Sciences. 2025; 15(22):12048. https://doi.org/10.3390/app152212048

Chicago/Turabian Style

Gao, Song, Enren Liu, Zhuorui Wu, Jun Li, and Meng Zhang. 2025. "Neural ODE-Based Frequency Stability Assessment and Control of Energy Storage Systems" Applied Sciences 15, no. 22: 12048. https://doi.org/10.3390/app152212048

APA Style

Gao, S., Liu, E., Wu, Z., Li, J., & Zhang, M. (2025). Neural ODE-Based Frequency Stability Assessment and Control of Energy Storage Systems. Applied Sciences, 15(22), 12048. https://doi.org/10.3390/app152212048

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop