AI-Based Faster-Than-Real-Time Stability Assessment of Large Power Systems with Applications on WECC System

: Achieving clean energy goals will require signiﬁcant advances in regard to addressing the computational needs for next-generation renewable-dominated power grids. One critical obstacle that lies in the way of transitioning today’s power grid to a renewable-dominated power grid is the lack of a faster-than-real-time stability assessment technology for operating a fast-changing power grid. This paper proposes an artiﬁcial intelligence (AI) -based method that predicts the system’s stability margin information (e


Introduction
As an enabling technology for operating a renewable-dominated power grid, the faster-than-real-time stability assessment technology for practical large power grids is not yet available in spite of the tremendous research efforts in this field over the past years. The power system stability assessment problem has been regarded as one of the most challenging and computationally expensive problems in power systems. The dominant approach of stability assessment in the industry is dynamic simulation, which requires solving the initial value problem of high-dimensional power system nonlinear differentialalgebraic equations (DAEs) with many possible contingencies occurring under various specific operating conditions [1,2]. Take the U.S. Eastern Interconnection (EI) system model as an example: the system has 70K buses and 5-10K generators, which lead to 100K+ state variables and 100K+ other variables (with lines, transformers, loads, etc.). The model also covers a wide range of time scales from several milliseconds to seconds. Solving such a complex model has been a long-standing challenge. Commercial software usually adopts the numerical integration and iteration methods to solve the DAE model with a tiny integration step of several milliseconds to satisfy the accuracy requirements and to avoid numerical instability. The current commercial software typically takes 5 min to run a 20 s full model simulation of the EI system. Most of the utilities run the simulations offline (e.g., in a day-ahead manner) in the current industry practice. However, such a day-ahead analysis, based on the assumption that the operating condition is highly predictable, no longer works for future grids. The hourly generation variations of wind and solar energy can be so large that the stability assessment performed in the previous 1-day or even 15-min operating condition would not serve as an accurate stability prediction for the next operating condition. This situation would become much worse in future scenarios with even higher penetration levels of intermittent renewable energy resources because the uncertainty of both weather and the electricity market makes the day head scheduling hard to cover all the possible operating condition variations during real-time dispatch.
To reliably operate a renewable-dominated power grid with large variations of operation conditions, the power system community seeks more powerful next-generation simulation tools for power system dynamic simulation and stability assessment. Especially, the capability of faster-than-real-time stability assessment is desired, i.e., the simulation speed is fast enough to predict where the system is moving toward before it actually happens. This would allow operators time to take proactive control actions. Without faster-than-real-time simulation capability, there is no time for corrective actions. In spite of the tremendous research effort on this topic, a faster-than-real-time stability assessment technology remains unavailable for large practical power systems.
Conventionally, most methods for power system stability assessment are based on time-domain simulation over detailed power system dynamic models, which is one of the most time-intensive computational tasks in power system operation. A lot of research in the literature was aimed at speeding up the time domain simulation, including: (1) model reduction, which reduces the dimensions of power system models based on certain assumptions. Examples include the coherency method [3,4] for reducing the dimension of generators and the reduced admittance matrix method [5] for reducing the dimension of buses. In particular, the reduced admittance matrix method under the constant impedance load assumption is widely used in the literature on power system simulation because it allows the nonlinear DAEs to be converted into ordinary differential equations with lower dimensions. The limitations of these methods lie in the sacrifice of accuracy during the model simplification.
(2) parallel computing, which leverages high-performance computers to speed up the simulations [6][7][8][9][10][11][12][13]. In these methods, the computation burdens of solving power system DAEs are split into multiple independent sub-computational tasks so that they could be executed in multiple cores. Many different methods are proposed to improve the parallelizability of power system simulation, for example, the multi-area Thévenin equivalents method [10], the waveform relaxation method [11], and the recently studied Parareal method [7,12,13]. These methods are often categorized as parallelin-time methods, parallel-in-space methods, or both. However, methods in this category often suffer from huge communication overhead and the time performance can saturate with the number of cores. (3) semi-analytical solution methods [14][15][16], which derive semi-analytical solutions of power system models which usually have higher orders than traditional numerical integration methods such that the integration time step lengths are enlarged, and the overall computational efficiency is improved. The semi-analytical solution of power system models could be derived by many methods, for example, the differential transformation method [14] and the Adomian decomposition method [15]. Recently, researchers are also investigating the potential of combining the semi-analytical solution methods and parallel computing methods for achieving faster-than-realtime simulation, for example, [12,13]. However, the potential of these methods for practical large-scale power systems remains to be further investigated.
Besides the model simulation, data-driven methods are also investigated, which further consist of measurement-based model reduction methods [17][18][19] and AI-based stability assessment methods [20][21][22][23][24][25][26][27]. In measurement-based methods, measurement data are often used to build reduced models such as transfer functions, which is a non-trivial Energies 2023, 16, 1401 3 of 12 process, and the accuracy remains to be further validated. In AI-based methods, most research works focus on transient stability problems and formulate the stability assessment problem as a classification to predict if the system is stable or unstable without providing the margin information. Recently, researchers in [25] also applied the machine learning approach in the frequency domain in order to predict the time-domain trajectory of power system models. A more detailed literature review on AI-based stability assessment methods is presented in the recent review papers [26,27]. Overall, most of the current research on AIbased methods focuses on the classification of a single stability problem, and the designed algorithms are mainly validated through small systems. In contrast, this paper targets a novel approach that could directly predict the stability margin for both frequency stability and transient stability. Such an approach is found to be easy to implement yet effective for practical large power systems.
To this end, the contributions of this paper are as follows. First, this paper proposes an AI-based stability assessment method that directly predicts the system's stability margin information (instead of classifying the system as stable or not) from the system operating conditions without performing the conventional time-consuming time-domain simulations over detailed dynamic models. Second, the proposed method can be applied to the prediction of both the frequency stability margin and transient stability margin (i.e., the frequency nadir and CCT values). Third, this paper examines the performance of the AI-based stability assessment method using multiple dispatch cases that are converted and tuned from actual dispatch cases of the Western Electricity Coordinating Council (WECC) system model with more than 20,000 buses.
The rest of this paper is organized as follows. Section 2 describes the AI-based stability assessment method. Section 3 is the case study using the actual full WECC system dispatch cases, followed by a brief discussion in Section 4. The conclusion is drawn in Section 5.

Overview
The basic idea of the proposed AI-based stability assessment method is illustrated in Figure 1. The goal of the AI agent in the online stage is to predict the stability margin information, including the frequency nadir in the frequency stability assessment and the CCT value in the transient stability assessment. The expected inputs could include the system operating conditions, network topology, circuit parameters, available measurements, etc. After being trained in the offline stage, the AI agent is expected to predict the stability margin of given power systems in a faster-than-real-time manner. stability assessment methods [20][21][22][23][24][25][26][27]. In measurement-based methods, measurement data are often used to build reduced models such as transfer functions, which is a non-trivial process, and the accuracy remains to be further validated. In AI-based methods, most research works focus on transient stability problems and formulate the stability assessment problem as a classification to predict if the system is stable or unstable without providing the margin information. Recently, researchers in [25] also applied the machine learning approach in the frequency domain in order to predict the time-domain trajectory of power system models. A more detailed literature review on AI-based stability assessment methods is presented in the recent review papers [26,27]. Overall, most of the current research on AI-based methods focuses on the classification of a single stability problem, and the designed algorithms are mainly validated through small systems. In contrast, this paper targets a novel approach that could directly predict the stability margin for both frequency stability and transient stability. Such an approach is found to be easy to implement yet effective for practical large power systems.
To this end, the contributions of this paper are as follows. First, this paper proposes an AI-based stability assessment method that directly predicts the system's stability margin information (instead of classifying the system as stable or not) from the system operating conditions without performing the conventional time-consuming time-domain simulations over detailed dynamic models. Second, the proposed method can be applied to the prediction of both the frequency stability margin and transient stability margin (i.e., the frequency nadir and CCT values). Third, this paper examines the performance of the AI-based stability assessment method using multiple dispatch cases that are converted and tuned from actual dispatch cases of the Western Electricity Coordinating Council (WECC) system model with more than 20,000 buses.
The rest of this paper is organized as follows. Section 2 describes the AI-based stability assessment method. Section 3 is the case study using the actual full WECC system dispatch cases, followed by a brief discussion in Section 4. The conclusion is drawn in Section 5.

Overview
The basic idea of the proposed AI-based stability assessment method is illustrated in Figure 1. The goal of the AI agent in the online stage is to predict the stability margin information, including the frequency nadir in the frequency stability assessment and the CCT value in the transient stability assessment. The expected inputs could include the system operating conditions, network topology, circuit parameters, available measurements, etc. After being trained in the offline stage, the AI agent is expected to predict the stability margin of given power systems in a faster-than-real-time manner.  The overall structure of the technical approach is as described in Figure 2, which has the following steps: (1) Create dynamic models for full WECC system based on the power flow from actual WECC Energy Management System data records under different dispatches and conduct data validation through power flow and dynamic simulation. (2) Batch simulation to obtain sufficient datasets related to frequency stability and transient stability, i.e., the frequency nadir and critical clearing time. (3) Extract features from the dispatch data, such as the operating conditions. (4) Construct datasets using the extracted features and stability labels and split the datasets into training data, validation data, and test data. (5) Perform training, validation, and testing of the machine learning models, such as the random forest models and neural network models, (6) Implement the developed AI agent and test the performance of stability prediction in real time.
Energies 2023, 16, x FOR PEER REVIEW 4 of 13 The overall structure of the technical approach is as described in Figure 2, which has the following steps: (1) Create dynamic models for full WECC system based on the power flow from actual WECC Energy Management System data records under different dispatches and conduct data validation through power flow and dynamic simulation. (2) Batch simulation to obtain sufficient datasets related to frequency stability and transient stability, i.e., the frequency nadir and critical clearing time. (3) Extract features from the dispatch data, such as the operating conditions. (4) Construct datasets using the extracted features and stability labels and split the datasets into training data, validation data, and test data. (5) Perform training, validation, and testing of the machine learning models, such as the random forest models and neural network models, (6) Implement the developed AI agent and test the performance of stability prediction in real time.

AI Algorithms
As a proof-of-concept study, this paper examined two AI algorithms, i.e., a random forest algorithm and a neural network algorithm, but other AI algorithms could be easily integrated into the proposed stability assessment framework as needed.
The random forest algorithm is an ensemble learning method, which integrates multiple decision tree models to achieve better prediction performance than a single decision tree. It is easy to implement and can avoid overfitting problems. The basic idea of the random forest algorithm is shown in Figure 3 [28]. It mainly includes two steps: bootstrap sampling and random feature extraction. First, it draws a set of samples with size m from the training dataset and builds a decision tree. Then, it selects features of each sample randomly and grows children nodes from parent nodes. Such a process is repeated for each terminal node of the decision tree until the minimum node size is obtained. Finally, the output of the random forest is a function of the outputs of each decision tree, for example, the average function.
The neural network model is also examined in this paper. First, a neural network, which takes selected features as the inputs and the stability margins information as the outputs, is constructed. For example, a fundamental component of the neural network is in (1), where , = 1, … are input features, are weights, represents the bias of a neuron, is the activation function, and * is the output of the neural network. Deep learning neural networks with multiple hidden layers can be constructed in a similar approach. Then, the loss function is defined in (2) as a mean squared error, which represents the discrepancy between the neural network outputs and the actual data points. Finally, the weights in the neural network are trained from the datasets by minimizing the loss function .

AI Algorithms
As a proof-of-concept study, this paper examined two AI algorithms, i.e., a random forest algorithm and a neural network algorithm, but other AI algorithms could be easily integrated into the proposed stability assessment framework as needed.
The random forest algorithm is an ensemble learning method, which integrates multiple decision tree models to achieve better prediction performance than a single decision tree. It is easy to implement and can avoid overfitting problems. The basic idea of the random forest algorithm is shown in Figure 3 [28]. It mainly includes two steps: bootstrap sampling and random feature extraction. First, it draws a set of samples with size m from the training dataset and builds a decision tree. Then, it selects features of each sample randomly and grows children nodes from parent nodes. Such a process is repeated for each terminal node of the decision tree until the minimum node size is obtained. Finally, the output of the random forest is a function of the outputs of each decision tree, for example, the average function.

Datasets Generation
The needed datasets for training the AI agents are generated as follows. First, timedomain simulations are performed over the detailed DAE model of power systems, as  The neural network model is also examined in this paper. First, a neural network, which takes selected features as the inputs and the stability margins information as the outputs, is constructed. For example, a fundamental component of the neural network is in (1), where u i , i = 1, . . . n are input features, w i are weights, b represents the bias of a neuron, ψ is the activation function, and z * is the output of the neural network. Deep learning neural networks with multiple hidden layers can be constructed in a similar approach. Then, the loss function e is defined in (2) as a mean squared error, which represents the discrepancy between the neural network outputs and the actual data points. Finally, the weights in the neural network are trained from the datasets by minimizing the loss function e.

Datasets Generation
The needed datasets for training the AI agents are generated as follows. First, timedomain simulations are performed over the detailed DAE model of power systems, as shown in (3), where x and y are the vectors of state variables and non-state variables, respectively; f represents the dynamics of generators, controllers, and other dynamic devices; g is the nonlinear AC power flow equation. To perform the time domain simulations, any numerical integration methods can be used, for example, the Modified Euler method or the Trapezoidal method. These methods are implemented by many power system commercial software tools such as PSS/E and PowerWorld. .
To obtain sufficient simulation data, massive simulations over multiple dispatches are needed. These dispatches are often mimicked by varying the load or generation based on certain operating conditions. However, dispatch cases obtained in this way may not reflect the real system's operational characteristics. To demonstrate the value of the proposed method to real-world power system models, this paper has developed dispatch cases based on the EMS data of the US WECC system.
After the simulation, the stability margin information of the dispatch cases can be calculated. The frequency nadir is calculated as the lowest frequency value in the median frequency response of all buses, as shown in

Datasets Generation
The needed datasets for training the AI agents are generated as follows. First, timedomain simulations are performed over the detailed DAE model of power systems, as shown in (3), where x and y are the vectors of state variables and non-state variables, respectively; f represents the dynamics of generators, controllers, and other dynamic devices; g is the nonlinear AC power flow equation. To perform the time domain simulations, any numerical integration methods can be used, for example, the Modified Euler method or the Trapezoidal method. These methods are implemented by many power system commercial software tools such as PSS/E and PowerWorld.
To obtain sufficient simulation data, massive simulations over multiple dispatches are needed. These dispatches are often mimicked by varying the load or generation based on certain operating conditions. However, dispatch cases obtained in this way may not reflect the real system's operational characteristics. To demonstrate the value of the proposed method to real-world power system models, this paper has developed dispatch cases based on the EMS data of the US WECC system.
After the simulation, the stability margin information of the dispatch cases can be calculated. The frequency nadir is calculated as the lowest frequency value in the median frequency response of all buses, as shown in Figure 4. The CCT value is calculated by varying the fault clearing time until the transient instability occurs.  In addition to the frequency nadir and CCT, the operating conditions of the dispatch cases will also be extracted, including the total generation and load, the total inertia, the power output of each generation and each load, and the inertia of each generator.

Results
The proposed method is tested on a full WECC system. The basic information of the system is as follows. The system has more than 4000 generators, 22,000 buses, 11,000 loads,  17,000 AC lines, and 8 DC lines. There are 22 areas in total connected by tie lines. The total generation is 149.8 GW, and the total load is 145.5 GW. The highest voltage level is 500kV, and the detailed voltage levels are shown in Figure 5.
In addition to the frequency nadir and CCT, the operating conditions of the dispatch cases will also be extracted, including the total generation and load, the total inertia, the power output of each generation and each load, and the inertia of each generator.

Results
The proposed method is tested on a full WECC system. The basic information of the system is as follows. The system has more than 4000 generators, 22,000 buses, 11,000 loads, 17,000 AC lines, and 8 DC lines. There are 22 areas in total connected by tie lines. The total generation is 149.8 GW, and the total load is 145.5 GW. The highest voltage level is 500kV, and the detailed voltage levels are shown in Figure 5. The proposed stability assessment method is implemented in the following four modules, as shown in Figure 6.
(1) Dispatch data module. This module is used to develop a set of robust dispatch cases and the associated dynamic models for the tests of the AI algorithm. Creation of these dispatch cases and dynamic models is a non-trivial task that involves tunings and exclusion of diverged cases. The output of this module is a set of data files to be used in the later steps. In this paper, the dispatch data are converted from the real dispatch cases in WECC Energy Management System (EMS) and stored as PowerWorld Simulator data files. Then, induvial tunning is conducted for the converted cases for further analysis. Eventually, we obtained 138 cases for frequency stability assessment and 69 cases for transient stability assessment from the original 228 WECC dispatch cases on 28 March 2019. (2) Massive simulation module. This module is used to perform batch simulations and calculate the frequency nadir and CCT values for the dispatch cases. These data will be used as labels in the AI algorithms. In this paper, the massive simulation is implemented in the MATLAB environment leveraging the Simulator Automation Server (SimAuto) provided by the PowerWorld Simulator. (3) Feature extraction module. This module is used to extract selected features from the dispatch cases. In this paper, the feature extraction is also implemented in MATLAB using the SimAuto tool, which allows the extraction of desired parameters of multiple devices from multiple dispatch cases in batch. (4) AI agent module. This module is used to build the dataset from the above label and feature data, splitting them into training, validation, and testing datasets and performing AI training and tests using AI algorithms. The outputs of this module are the predicted nadir values and the predicted CCT values. In this paper, the AI agent is implemented in MATLAB. The proposed stability assessment method is implemented in the following four modules, as shown in Figure 6.

Massive Simulation Results
To test the performance of the AI agent in predicting the frequency stability margin, the disturbance is selected as a large generator drop event that loses two large generators, each with a power output of 1.37 GW. Such a disturbance is applied to all 138 dispatch cases with different operating conditions. Then, we perform the time domain simulation for all 138 dispatch cases to obtain the frequency response. After that, we calculate the frequency nadir value of each dispatch case using the method illustrated in Figure 4, i.e., the lowest frequency value in the median frequency response of all buses. Finally, 138 frequency nadir data points are generated, as shown in Figure 7. Note that the 138 dispatch cases are not evenly distributed over the one-day period because we have removed certain problematic cases that fail to converge. Figure 7a shows the results with the horizontal axis being the time stamp for a 1-day time period with an interval of 6 min. The missing data points represent the problematic cases that are not used to calculate frequency nadir here. For the convenience of machine learning in the subsequent studies, the missing data points are removed to generate in Figure 7b, with the horizontal axis being the index of data points. These data points are used as labels in the machine learning algorithms. (1) Dispatch data module. This module is used to develop a set of robust dispatch cases and the associated dynamic models for the tests of the AI algorithm. Creation of these dispatch cases and dynamic models is a non-trivial task that involves tunings and exclusion of diverged cases. The output of this module is a set of data files to be used in the later steps. In this paper, the dispatch data are converted from the real dispatch cases in WECC Energy Management System (EMS) and stored as PowerWorld Simulator data files. will be used as labels in the AI algorithms. In this paper, the massive simulation is implemented in the MATLAB environment leveraging the Simulator Automation Server (SimAuto) provided by the PowerWorld Simulator. (3) Feature extraction module. This module is used to extract selected features from the dispatch cases. In this paper, the feature extraction is also implemented in MATLAB using the SimAuto tool, which allows the extraction of desired parameters of multiple devices from multiple dispatch cases in batch. (4) AI agent module. This module is used to build the dataset from the above label and feature data, splitting them into training, validation, and testing datasets and performing AI training and tests using AI algorithms. The outputs of this module are the predicted nadir values and the predicted CCT values. In this paper, the AI agent is implemented in MATLAB.

Massive Simulation Results
To test the performance of the AI agent in predicting the frequency stability margin, the disturbance is selected as a large generator drop event that loses two large generators, each with a power output of 1.37 GW. Such a disturbance is applied to all 138 dispatch cases with different operating conditions. Then, we perform the time domain simulation for all 138 dispatch cases to obtain the frequency response. After that, we calculate the frequency nadir value of each dispatch case using the method illustrated in Figure 4, i.e., the lowest frequency value in the median frequency response of all buses. Finally, 138 frequency nadir data points are generated, as shown in Figure 7. Note that the 138 dispatch cases are not evenly distributed over the one-day period because we have removed certain problematic cases that fail to converge. Figure 7a shows the results with the horizontal axis being the time stamp for a 1-day time period with an interval of 6 min. The missing data points represent the problematic cases that are not used to calculate frequency nadir here. For the convenience of machine learning in the subsequent studies, the missing data points are removed to generate in Figure 7b, with the horizontal axis being the index of data points. These data points are used as labels in the machine learning algorithms.

Massive Simulation Results
To test the performance of the AI agent in predicting the frequency stability margin, the disturbance is selected as a large generator drop event that loses two large generators, each with a power output of 1.37 GW. Such a disturbance is applied to all 138 dispatch cases with different operating conditions. Then, we perform the time domain simulation for all 138 dispatch cases to obtain the frequency response. After that, we calculate the frequency nadir value of each dispatch case using the method illustrated in Figure 4, i.e., the lowest frequency value in the median frequency response of all buses. Finally, 138 frequency nadir data points are generated, as shown in Figure 7. Note that the 138 dispatch cases are not evenly distributed over the one-day period because we have removed certain problematic cases that fail to converge. Figure 7a shows the results with the horizontal axis being the time stamp for a 1-day time period with an interval of 6 min. The missing data points represent the problematic cases that are not used to calculate frequency nadir here. For the convenience of machine learning in the subsequent studies, the missing data points are removed to generate in Figure 7b, with the horizontal axis being the index of data points. These data points are used as labels in the machine learning algorithms. To test the performance of the AI agent in predicting transient stability, a branch fault contingency is created. The branch is selected as one of the branches with the highest  To test the performance of the AI agent in predicting transient stability, a branch fault contingency is created. The branch is selected as one of the branches with the highest power flow MVA limit. The fault happens at 1 s and is cleared by opening both the near and far ends of the branch after a certain time. The fault clearing time is searched by gradually increasing its value until finding the CCT value. The criteria to determine transient stability is rotor angle deviation no larger than 180 degrees. It was defined as a transient limiter monitoring in PowerWord as shown in Figure 8 and the setting is further written as ancillary files in order to run batch simulations in MATLAB. Eventually, Figure 9 shows the CCT values of the 69 dispatch cases. power flow MVA limit. The fault happens at 1 s and is cleared by opening both the near and far ends of the branch after a certain time. The fault clearing time is searched by gradually increasing its value until finding the CCT value. The criteria to determine transient stability is rotor angle deviation no larger than 180 degrees. It was defined as a transient limiter monitoring in PowerWord as shown in Figure 8 and the setting is further written as ancillary files in order to run batch simulations in MATLAB. Eventually, Figure 9 shows the CCT values of the 69 dispatch cases.   Figure 10 shows the results we obtained from the tests on the full 20,000-bus WECC system, including the predicted frequency nadir and CCT value using both the random forest algorithm and the neural network algorithm. It shows that the AI agent provides an accurate prediction of this stability margin information. Table 1 gives the time performance of the proposed AI approach and the conventional time-domain simulation method. It shows that the AI approach only takes less than 1 h for offline training and the online evaluation only takes less than 0.2 milliseconds to complete the stability prediction of all dispatch cases. This is significantly faster than the conventional time domain simulation approaches, which take more than 1 h to calculate this stability margin information. and far ends of the branch after a certain time. The fault clearing time is searched by gradually increasing its value until finding the CCT value. The criteria to determine transient stability is rotor angle deviation no larger than 180 degrees. It was defined as a transient limiter monitoring in PowerWord as shown in Figure 8 and the setting is further written as ancillary files in order to run batch simulations in MATLAB. Eventually, Figure 9 shows the CCT values of the 69 dispatch cases.   Figure 10 shows the results we obtained from the tests on the full 20,000-bus WECC system, including the predicted frequency nadir and CCT value using both the random forest algorithm and the neural network algorithm. It shows that the AI agent provides an accurate prediction of this stability margin information. Table 1 gives the time performance of the proposed AI approach and the conventional time-domain simulation method. It shows that the AI approach only takes less than 1 h for offline training and the online evaluation only takes less than 0.2 milliseconds to complete the stability prediction of all dispatch cases. This is significantly faster than the conventional time domain simulation approaches, which take more than 1 h to calculate this stability margin information.  Figure 10 shows the results we obtained from the tests on the full 20,000-bus WECC system, including the predicted frequency nadir and CCT value using both the random forest algorithm and the neural network algorithm. It shows that the AI agent provides an accurate prediction of this stability margin information. Table 1 gives the time performance of the proposed AI approach and the conventional time-domain simulation method. It shows that the AI approach only takes less than 1 h for offline training and the online evaluation only takes less than 0.2 milliseconds to complete the stability prediction of all dispatch cases. This is significantly faster than the conventional time domain simulation approaches, which take more than 1 h to calculate this stability margin information. These results demonstrate the great potential of AI techniques in achieving faster-than-real-time stability assessment. These results demonstrate the great potential of AI techniques in achieving faster-thanreal-time stability assessment. Figure 10. Performance of the developed AI-based stability assessment tool on the full 20,000-bus WECC system: (a) predicted frequency nadir using the random forest algorithm, (b) predicted frequency nadir using the neural network algorithm, (c) predicted CCT value using the random forest algorithm, (d) predicted CCT value using the neural network algorithm. The prediction accuracy is quantified by the root mean square error (RMSE) of the test data points. Take the frequency nadir prediction as an example, Figure 11 shows the predicted frequency nadir, the benchmark values from simulation results, and the errors for both the neural network model and the random forest model. It shows the errors are in the magnitude of 10 −3 Hz for both AI models, and the neural network model gives slightly smaller errors than the random forest model. Figure 10. Performance of the developed AI-based stability assessment tool on the full 20,000-bus WECC system: (a) predicted frequency nadir using the random forest algorithm, (b) predicted frequency nadir using the neural network algorithm, (c) predicted CCT value using the random forest algorithm, (d) predicted CCT value using the neural network algorithm. The prediction accuracy is quantified by the root mean square error (RMSE) of the test data points. Take the frequency nadir prediction as an example, Figure 11 shows the predicted frequency nadir, the benchmark values from simulation results, and the errors for both the neural network model and the random forest model. It shows the errors are in the magnitude of 10 −3 Hz for both AI models, and the neural network model gives slightly smaller errors than the random forest model. Figure 12 further shows the mean squared error along the number of epochs in the training process of the neural network algorithm, using the CCT prediction as an example. It shows that the error decreases rapidly and achieves acceptable accuracy levels with less than 30 epochs.

Stability Prediction Results
To test the impact of feature selection, the following two strategies are tested: (1) the MW output of all 4270 generators and the inertia of 3336 synchronous generators, and (2) the MW output and inertia of the 10 generators with the largest MW outputs. Figure 13 shows the second strategy with fewer features could give a relatively good prediction of the frequency nadir, despite the slightly larger error than the first strategy. This result shows the robustness of the developed AI agent against different feature selection strategies.  Figure 11. Error quantification of the AI-based frequency stability prediction. Figure 12 further shows the mean squared error along the number of epochs in the training process of the neural network algorithm, using the CCT prediction as an example. It shows that the error decreases rapidly and achieves acceptable accuracy levels with less than 30 epochs. To test the impact of feature selection, the following two strategies are tested: (1) the MW output of all 4270 generators and the inertia of 3336 synchronous generators, and (2) the MW output and inertia of the 10 generators with the largest MW outputs. Figure 13 shows the second strategy with fewer features could give a relatively good prediction of the frequency nadir, despite the slightly larger error than the first strategy. This result shows the robustness of the developed AI agent against different feature selection strategies.  Figure 12 further shows the mean squared error along the number of epochs in the training process of the neural network algorithm, using the CCT prediction as an example. It shows that the error decreases rapidly and achieves acceptable accuracy levels with less than 30 epochs. To test the impact of feature selection, the following two strategies are tested: (1) the MW output of all 4270 generators and the inertia of 3336 synchronous generators, and (2) the MW output and inertia of the 10 generators with the largest MW outputs. Figure 13 shows the second strategy with fewer features could give a relatively good prediction of the frequency nadir, despite the slightly larger error than the first strategy. This result shows the robustness of the developed AI agent against different feature selection strategies. The error of CCT prediction during the training process using the neural network algorithm.

Discussion
With the increase of intermittent resources and reduced system inertia, tomorrow's grid will experience fast-changing system dynamics. Real-time stability assessment becomes necessary in order to enable fast corrective actions. The conventional dynamic simulation cannot meet the speed demand of real-time stability assessment, especially for large systems like the WECC system. AI could bridge this major gap by developing a direct connection between system dispatch and stability margins. The AI approach could trade massive offline simulations to allow fast stability assessment online. Such an ability is critical for operating a fast-varying grid with high renewables.
As a proof-of-concept study, this paper focused on evaluating the potential of AI in predicting stability margins in real-world large-scale power systems. Despite the relatively small size of datasets and the relatively simple AI models, the results have been quite encouraging. On the one hand, the evaluation of a trained AI agent is extremely fast.

Discussion
With the increase of intermittent resources and reduced system inertia, tomorrow's grid will experience fast-changing system dynamics. Real-time stability assessment becomes necessary in order to enable fast corrective actions. The conventional dynamic simulation cannot meet the speed demand of real-time stability assessment, especially for large systems like the WECC system. AI could bridge this major gap by developing a direct connection between system dispatch and stability margins. The AI approach could trade massive offline simulations to allow fast stability assessment online. Such an ability is critical for operating a fast-varying grid with high renewables.
As a proof-of-concept study, this paper focused on evaluating the potential of AI in predicting stability margins in real-world large-scale power systems. Despite the relatively small size of datasets and the relatively simple AI models, the results have been quite encouraging. On the one hand, the evaluation of a trained AI agent is extremely fast. On the other hand, the AI agent directly predicts the stability margin based on the steadystate operating conditions, which does not need to develop real-time dynamic models. In practice, creating reliable dynamic models from EMS is a complicated task. Timeconsuming tunings of individual cases are required. The 228 WECC dispatch cases we originally converted from EMS suffer from various issues and are not directly available for massive simulation and machine learning applications. After continuous tunings, we eventually obtained 138 successful cases out of 228 cases in the frequency stability prediction and only obtained 69 successful cases in the current transient stability prediction. If future high renewable cases are to be included in the power flow cases, the dynamic cases will be even more challenging to create. Currently, it would be impossible to do this in real time. However, AI could offer results of an unknown dispatch in a fraction of a second as accurately as shown in Figure 9.

Conclusions
This paper proposes and implements an AI-based method for predicting the stability margin of large-scale power systems. It provides accurate predictions of the frequency nadir and CCT values directly from the system operating conditions without performing the conventional time-consuming time-domain simulations over detailed dynamic models. Since the majority of the computational burden is shifted to offline training, the online evaluation of a trained AI agent is extremely fast. The encouraging results on full WECC system models using real-world data from EMS show the great potential of the AI-based approach to achieve faster-than-real-time stability assessment for practical large power systems while preserving sufficient accuracy.