An Intelligent Location Method for Power System Oscillation Sources Based on a Digital Twin

: Aiming at the difﬁcult problem of broadband oscillation localization in power systems, the intelligent localization method of an oscillation source based on a digital twin is proposed, and the oscillation source localization system is thus constructed. Firstly, a digital twin-based oscillation source localization method and its system architecture are proposed. Furthermore, an intelligent positioning method of the oscillation source, based on data-driven and mechanism fusion, is proposed. It includes three steps: oscillation signal preprocessing, oscillation modal analysis and oscillation source localization. For the oscillation signal preprocessing, the generative adversarial imputation network is used to repair the missing samples, and the super-resolution technique is used to realize the super-resolution measurement of broadband oscillation. In the oscillation modal analysis, the spectrum of the oscillation signal is extracted using the fast Fourier transform. To accurately locate the oscillation source, branch potential energy is used as the input to the data-driven model, such as LSTM and CNN. Finally, an oscillation source localization system is developed based on the digital twin workshop CloudPSS-XStudio, which can locate the oscillation source quickly and accurately.


Introduction
Renewable energy will replace fossil energy in modern power systems.Renewable energy sources are connected to the power grid through power converters, which will make the power system exhibit the characteristics of highly penetrative power electronics.The high penetration of power electronic equipment provides system coupling between the generation side, load side and transmission network in many forms with variable oscillation modes, showing strong time-variability, stochasticity, and strong nonlinearity [1,2].As a result, the probability of system oscillations caused by power electronic devices will increase significantly.
To control broadband oscillation, it is necessary to localize the oscillation source.At present, oscillation localization methods can be divided into three categories: an analytical calculation method, a numerical analysis method and a data-driven method.The analytical calculation method mainly includes the complex torque coefficient method [3], the state-space method [4] and the impedance method [5], which can accurately reflect the relationship between the oscillation characteristics and the influencing factors.The numerical analysis method mainly solves the power system mathematical model from the perspective of an electromechanical transient or electromagnetic transient, in which the energy method is representative of this method [6].The above two methods have good interpretability based on the mechanism model, but they are applicable to a single scenario, and their accuracy and generalization ability need to be improved when dealing with the new power system broadband oscillation localization problems with strong randomness and nonlinearity.
Data-driven oscillation source localization methods [7] are mostly oriented to engineering programs.They use actual electrical quantity data as their input and build neural models to realize the localization.There is some research on deep learning-based oscillation source warning and localization through the training of neural network models with effective extraction and fitting to the oscillation characteristics.This achieves a high localization accuracy, but its mathematical interpretability is poor.
Digital twin technology has been used in the simulation, analysis and control of power systems.Reference [8] develops an approach that treats the OPF problem as a functional mapping between the system operating status and OPF solutions.Reference [9] proposes a confidence-oriented model updating strategy, which only requires small sample data to update the model.Reference [10] develops the first data-oriented, real-time electromagnetic transient simulation platform, ECS-Grid, for cyber-physical power systems (CPPS).However, most of the methods are still difficult to deploy on the user side, as they always rely on special devices, drivers, compilers, and cumbersome configurations [11].However, digital twin techniques have not been used in the power system oscillation location.To this end, this paper proposes an intelligent location method based on the digital twin and develops an intelligent location system based on CloudPSS, a cloud computing-based simulation platform that adopts both the CPU and GPU as computing devices.
Aiming at the problems above, the paper proposes an intelligent localization method and system for oscillation sources based on the digital twin.Contributions of this paper are summarized as follows: • A data and mechanism fusion power system oscillation source localization method is proposed, achieving accurate oscillation location of a power system.• A power system oscillation source localization system is developed based on the digital twin workshop CloudPSS-XStudio.The oscillation location system is a cloud computing-based software and is portable.
The remainder of this paper is organized as follows.Section 2 introduces the digital twin construction for the power system, and Section 3 proposes the oscillation source localization algorithms, including three parts: acquired signal preprocessing, modal analysis of oscillation and oscillation source localization.Section 4 develops an oscillation source location system based on the digital twin platform CloudPSS-Xstuido.Section 5 discusses the example test results, and the conclusion is provided in Section 6.

Digital Twin Framework
The concept of digital twin was first proposed by Prof. Michael Grieves of the University of Michigan in 2002.The digital twin makes full use of the physical model, sensor update, operation history and other data, integrates multi-disciplinary, multi-physical quantities, multi-scale and multi-probability simulation processes, completes the mapping in the virtual space, and reflects the whole life cycle of the corresponding physical equipment.Digital twin technology includes the construction of digital space models and various techniques for simulation, analysis, prediction and control [12].To realize the access and management of data sources and business modules of the digital twin, the digital twin framework shown in Figure 1 is designed [13].In this, the intelligent perception system establishes the data interaction between the actual physical system and the digital twin model; the intelligent application system builds various advanced digital applications based on the digital twin model.
Through digital twin technology, power systems can be modeled in digital space, including the establishment of energy systems and auxiliary control system models.On the one hand, one can analyze the power system on the digital twin.At the same time, part of the operational data of the power system used in the data-driven intelligence can be obtained by the digital twin.On the other hand, we can verify the effectiveness of the control strategy of the power system on the digital twin and then apply it to the real power system.Through digital twin technology, power systems can be modeled in digital space, including the establishment of energy systems and auxiliary control system models.On the one hand, one can analyze the power system on the digital twin.At the same time, part of the operational data of the power system used in the data-driven intelligence can be obtained by the digital twin.On the other hand, we can verify the effectiveness of the control strategy of the power system on the digital twin and then apply it to the real power system.

Construction of Digital Twin Application
Based on the digital twin framework shown in Figure 1, CloudPSS-XStudio, a digital twin workshop for power systems is established [14], which contains three parts: model workshop CloudPSS SimStudio, function workshop CloudPSS FuncStudio, and application workshop CloudPSS AppStudio.
CloudPSS is an electromagnetic transient program (EMTP) based on cloud computing and has a flexible interface.EMT models are used in the calculation.CloudPSS can generate EMT simulation projects of large-scale power grids automatically based on electromechanical transient simulation projects or other data.At the same time, an electromagnetic transient simulation parameter correction method, based on the Gaussian mixture model, is proposed, and the parameters of the simulation model are dynamically identified and corrected by using the field data.Based on the two techniques, the digital twin of a power system is constructed.The CloudPSS-XStudio platform is deployed on a heterogeneous cloud computing platform [11].In this paper, it is installed on a server with an I7-12900K processor and 32G RAM.
In this paper, CloudPSS-XStudio is used to construct a digital twin application for power system oscillation source localization, and the construction process mainly consists of the following three steps.First, the simulation model of the system to be studied is constructed in CloudPSS SimStudio.Second, the data-driven and mechanism fusion oscillation source localization algorithm and program are encapsulated in CloudPSS FuncStudio.Third, the User Interface (UI) and visualization interface are designed in CloudPSS AppStudio to show the results of oscillation source localization in FuncStudio.The construction of the simulation model can be referred to in [15], and the oscillation source localization algorithm and application construction are described in detail in the following.

Construction of Digital Twin Application
Based on the digital twin framework shown in Figure 1, CloudPSS-XStudio, a digital twin workshop for power systems is established [14], which contains three parts: model workshop CloudPSS SimStudio, function workshop CloudPSS FuncStudio, and application workshop CloudPSS AppStudio.
CloudPSS is an electromagnetic transient program (EMTP) based on cloud computing and has a flexible interface.EMT models are used in the calculation.CloudPSS can generate EMT simulation projects of large-scale power grids automatically based on electromechanical transient simulation projects or other data.At the same time, an electromagnetic transient simulation parameter correction method, based on the Gaussian mixture model, is proposed, and the parameters of the simulation model are dynamically identified and corrected by using the field data.Based on the two techniques, the digital twin of a power system is constructed.The CloudPSS-XStudio platform is deployed on a heterogeneous cloud computing platform [11].In this paper, it is installed on a server with an I7-12900K processor and 32G RAM.
In this paper, CloudPSS-XStudio is used to construct a digital twin application for power system oscillation source localization, and the construction process mainly consists of the following three steps.First, the simulation model of the system to be studied is constructed in CloudPSS SimStudio.Second, the data-driven and mechanism fusion oscillation source localization algorithm and program are encapsulated in CloudPSS FuncStudio.Third, the User Interface (UI) and visualization interface are designed in CloudPSS AppStudio to show the results of oscillation source localization in FuncStudio.The construction of the simulation model can be referred to in [15], and the oscillation source localization algorithm and application construction are described in detail in the following.

Oscillation Source Localization Algorithms
There is a need for real-time monitoring and fault location of broadband oscillations in power systems with new energy access.At the same time, there are some practical problems in engineering applications, such as the cost of computing hardware, the inconsistency of Power Management Unit (PMU) sampling frequency, noise interference and data loss, which may occur in the process of signal acquisition and transmission.Therefore, an oscillation source location method is proposed, which includes three aspects: oscillation signal preprocessing, oscillation mode analysis and oscillation source location.

Generative Adversarial Imputation Network
The data-driven oscillation intelligent localization model requires good oscillation samples as the training set.However, the field environment of the actual power system is complex, and system failures or disturbances from the environment may occur in various processes such as data acquisition, measurement, transmission and conversion.It may result in uncertainties, such as missing abnormalities of the measurement data, and affect the robustness and accuracy of the subsequent localization model [16].In addition, the sampling frequency of the measurement devices in the actual power system is low and there may be differences in sampling frequency between different devices.Additionally, the quality of the actual measurement samples is poor, which is not conducive to the training of the localization model.Therefore, in this paper, the generative adversarial imputation network (GAIN) is used to achieve highly accurate repair of missing samples.At the same time, a super-resolution measurement of broadband oscillation is realized based on super-resolution (SR) to ensure the synchronization of sampling frequency and data integrity of broadband oscillation measurement samples, which is convenient for the subsequent training of positioning models.
In order to solve the problem of missing data, classical mathematical methods, such as mean completer and multiple imputation, are often applied to reconstruct missing data.However, these methods ignore the time-series characteristics and correlation of power system measurement data.The restoration accuracy does not meet the requirements of engineering applications.In recent years, some studies have utilized emerging deep learning technology for data restoration, such as residual U-network [17] and generative adversarial network (GAN) [18].However, such methods require a complete data sample for training, and it is difficult to obtain a complete sample in the actual power system, so the methods above are more limited in engineering applications.In contrast, the GAIN is an unsupervised learning model based on GAN, which does not require a complete dataset for training to repair the data [19].A large number of examples have proved that GAIN still has a high repair accuracy in the face of the complexity of data with random missing, continuous missing and noise interference, and its structure is shown in Figure 2. Reference [20] describes the specific training process of the GAIN model.In training on complete data, GAIN uses missing data, as the model's input and complete the data after imputation.In the training process, the mask matrix and matrix are constructed according to the missing corresponding positions of each Reference [20] describes the specific training process of the GAIN model.Instead of training on complete data, GAIN uses missing data, as the model's input and outputs complete the data after imputation.In the training process, the mask matrix and random matrix are constructed according to the missing corresponding positions of each element in the original matrix.Then, the data matrix, random matrix and mask matrix are input into GAIN; the generator G generates an interpolation matrix to approximate the data matrix, and the discriminator D combines the hint matrix to distinguish whether each element in the input matrix is a real element in the data matrix, and outputs the estimated mask matrix.Through adversarial training, the generator can learn the distribution of real elements in the data matrix.The objective function is: where M is the mask matrix; X is the matrix after interpolation by G; and H is the hint matrix generated by the hint generator, which provides the discriminator with partial information about the missing data and helps to strengthen the antagonistic game process of G and D.
After the training of the GAIN model is completed, the timing data of the oscillation samples to be repaired are input into the generator of GAIN.The output is the completed oscillation samples.

Super Resolution Measurement
To cope with the problem of differences between measurement devices with low sampling frequencies, Super-Resolution [21] is used for the measurement processing of broadband oscillation samples.It recovers multi-source, low-frequency data with different sampling frequencies to high-frequency data, with a unified sampling frequency to support more accurate and reliable data analysis, model training, and other possible application aspects.
When dealing with timing data of broadband oscillation samples, the method can be summarized as follows: For a given time period T, the dimension of the low-frequency data l is d, while the dimension of corresponding high-frequency data h at the reference frequency is αd.The super-resolution measure mapping is a function: F : R d → R a×d .It can be realized by a deep neural network.The neural network is trained using the mean square error with the loss function: (2) The network is then optimized by minimizing the loss function: where θ is the parameter set of the deep neural network F. Due to the ill-definiteness of the super-resolution measurement problem, regularization is needed to constrain the solution.According to the maximum a posteriori estimation, given a low-frequency sequence l, the corresponding high-frequency sequence h can be estimated by the following optimization problem: where min h Ah − l 2 2 is the distortion measurement term under the Gaussian noise assumption, while Ω(h) represents the regularization term containing prior information.This equation shows that h', shown in Equation ( 2), is a function of the input h and the downsampling matrix A. The maximum a posteriori estimated solution for super-resolution measurements is equivalent to: When A is fixed, it is equivalent to the super-resolution measurement map constructed above.This equation shows that the prior information is actually contained in the network parameter set θ.The deep neural network uses implied prior knowledge to estimate highfrequency sequences.On the other hand, the proposed deep neural network not only avoids directly modeling the prior distribution of h, but also transforms the optimization problem into an inference problem, which improves the computational efficiency.
In (5), the function F is implemented using a deep convolutional neural network (CNN).Since the goal of the CNN here is to generate high-frequency signals rather than classification, it is necessary to design a neural network that can capture the timing relationships of the data and satisfy the properties of the super-resolution metrology problem.Therefore, in this paper, based on the super-resolution convolutional neural network (SRCNN) proposed in the research of image super-resolution [22], its network structure and parameters are improved to meet the requirements above.Additionally, the computational inefficiency of the traditional CNN outputting one-dimensional sequential data is solved by adopting a fully convolutional design and parallel processing method.Finally, by inputting the low-frequency measurement data into the trained SRCNN and specifying the required reference sampling frequency, the low-frequency measurement samples can be mapped to the specified reference frequency.It facilitates subsequent tasks such as broadband oscillation spectrum analysis and localization model training.

Modal Analysis of Oscillation
Accurate identification of oscillation modes can obtain the frequency, amplitude and other information of the oscillation.It provides effective information support for the subsequent localization of the oscillation source.In this paper, fast Fourier transform (FFT) is used to process the measured values of PMU to obtain its spectral characteristics.Therefore, the main oscillation components are judged and the oscillation modes are identified through it.
Meanwhile, FFT analysis can be used to determine whether the system is experiencing oscillations.Therefore, the modal analysis in this session can be used as a subsequent startup criterion for the localization of the oscillation source, avoiding the waste of computational resources and transmission bandwidth caused by the real-time invocation of the localization network.

Mechanism and Data-Driven Fusion Methods for Oscillation Source Localization
Considering that traditional oscillation localization methods mostly rely on accurate mechanism models, they can only be used in limited situations.Their accuracy and generalization ability needs to be improved when dealing with new power system oscillation localization problems with strong stochasticity and strong nonlinearity.Data-driven artificial intelligence methods are mostly engineering-oriented [23,24], taking actual electrical data as input and building neural models to realize localization.They are more efficient but less mathematically interpretable.Therefore, this paper intends to use the long short-term memory (LSTM), CNN and other neural network models in the data-driven algorithm, combined with the branch potential energy function, to propose a mechanism and data-driven fusion oscillation source localization method.

•
Oscillation Source Location Method Based on Branch Potential Energy Method The branch potential method for oscillation localization in power systems is a classical technique for power system oscillation localization.The core idea is to select a few key branches in a power system and measure their parameters such as current, voltage and phase, then calculate their power and potential energy.During the operation of the system, the potential energy of these branch components will change periodically as the oscillation occurs [25].Therefore, it is possible to determine whether the oscillation occurs by the potential energy change of these branch components.
The branching potential energy method is briefly described below.To simplify the analysis, the classical second-order generator model is used to construct the branch-circuit potential energy function of the system.The rotor equation of motion of the generator is: where M represents the inertia time constant of the generator, δ represents the rotor angle of the generator with respect to the infinity system, ω represents the generator electrical angular velocity deviation, P M represents the generator mechanical power, P E represents the generator electromagnetic power, and D represents the generator mechanical damping coefficient.Further, based on the classical second-order model of the generator, we can deduce the transient energy function of the system specifically by taking the angular frequency of a node as the reference angular frequency.The relative angular frequency of each node can be defined as: Based on the system power balance, substituting Equation ( 7) into the generator rotor equation of motion, the transient energy function of the system can be obtained as: where V K represents the kinetic energy of the system, V pb represents the sum of the potential energy of the branch, V L represents the load energy, V D represents the damping energy, P(t) represents the active power when oscillation occurs on the branch, and P S represents the active power of the line when the branch is in steady state; the subscript k represents the branch roads; the subscript L represents the loads; ω ij represents the difference in angular frequency between nodes i and j connected to the branch k; ∆ω G represents the relative rotational speed of the generator; ∆ω G represents the relative rotational speed of the loads; ∆ω N represents the relative angular frequency of node connected to the loads; n is the number of nodes of the system, and i is the number of generators in the system.The branching potential in a network can be defined as: where P K is the active power of the branch when the oscillation occurs, and P S K is the active power of the line when the branch is in the steady state.
Oscillation source localization can be achieved based on the trend of the branch potential energy time series trajectory.The potential energy of the branch near the center of oscillation will change substantially [26].

• Data-Driven Oscillation Source Localization Method
In recent years, data-driven oscillation source localization methods are mostly engineeringoriented, using actual electrical quantity data as their input to build a model to realize localization.It can achieve the localization of low-frequency oscillation faults without a mechanism model.Machine learning-based oscillation source localization methods can effectively extract and fit the oscillation features by training the network and achieving high localization accuracy [27].
Deep neural networks contain multiple hidden layers.Based on the backpropagation algorithm, the network models can extract effective information from the training samples.In this paper, CNN and LSTM-based branch potential signal localization models are built, respectively.The hidden layers of them realize feature extraction and data dimensionality reduction, and the activation function of the output layer is chosen to be the Softmax function.The model can realize the localization of the oscillation source unit by inputting the branch potential signal.

• Oscillation Source Localization Method Based on Mechanism and Data Fusion
In order to combine the advantages of mechanism-based and data-driven oscillation source localization methods, this paper combines the branch potential energy method with the data-driven model to build a model.The branch potential energy is used as the model input to realize the precise location of the oscillation source.
Compared with directly taking the electrical quantity time series as input, the branch potential energy can better represent the oscillation of the electrical quantity on the line.Additionally, the branch potential energy function is relatively simple to construct, and the required information is easier to obtain in actual engineering, which is more economical.The branch potential energy reflects the energy flow direction and energy size on the line.When oscillation occurs, the direction of the oscillation source can be inferred from it, providing effective information for localization, and better training results can be obtained with data-driven models.

Cross-Validation of Double Solvers
In the oscillation source localization process above, the results obtained by using different computational models may also be different.It will have a negative impact on the judgment.For this reason, this paper proposes a cross-validation method.Its specific process is shown in Figure 3. First, the Kullback-Leibler divergence (KL divergence) of the distribution results of different oscillation sources and all distribution samples are calculated separately, and the smallest value is retained; then, the smallest KL divergence is normalized and transformed into the reliability; finally, the weighted average is used to obtain the final probability of the distribution of the oscillation sources.For a system with a number n of PMUs, each prediction distribution result is calculated to obtain a total of n KL divergences.In this paper, the minimum value is selected to enter the next step of normalization.Since ( ) ( || ) 1, KL p q ∈ +∞ , the minimum divergence is normalized to construct the reliability α, and the expression is shown in Formula (10).
( ) where the KL divergence of the probability distributions P and Q is calculated as follows: where ( ) p x , ( ) q x are the distribution functions of the two probability distributions.
From Equation (10), it is shown that α∈(0,1), and the smaller the KL divergence, the larger α is, that is, the possibility of the corresponding result being correct is also larger, and vice versa.It is shown that the α obtained after normalization can correctly reflect the reliability of the results and can be used as valid data for the subsequent process.
Further, the different results obtained by each algorithm are weighted averaged, using the α above, to obtain the final oscillation source localization probability distribution.It is shown in Equation ( 12 For a system with a number n of PMUs, each prediction distribution result is calculated to obtain a total of n KL divergences.In this paper, the minimum value is selected to enter the next step of normalization.Since KL(p||q) ∈ (1, +∞) , the minimum divergence is normalized to construct the reliability α, and the expression is shown in Formula (10).
where the KL divergence of the probability distributions P and Q is calculated as follows: where p(x), q(x) are the distribution functions of the two probability distributions.
From Equation (10), it is shown that α∈(0,1), and the smaller the KL divergence, the larger α is, that is, the possibility of the corresponding result being correct is also larger, and vice versa.It is shown that the α obtained after normalization can correctly reflect the reliability of the results and can be used as valid data for the subsequent process.
Further, the different results obtained by each algorithm are weighted averaged, using the α above, to obtain the final oscillation source localization probability distribution.It is shown in Equation ( 12): where n is the number of solvers, and α i , p i (x) are the reliability and probability distribution of the ith result, respectively.Double-solver cross-validation unifies the prediction results of different solvers, improving the accuracy and reliability of the prediction results.

Development of an Oscillation Source Location System Based on Digital Twin Platform CloudPSS-XStuido
Because of the need for real-time monitoring and fault location of power system oscillation of different modes, the authors decided to develop an oscillation source analysis and location system for the above needs.At present, a new type of power system software has been formed, which takes the mode analysis of oscillation and the source location as the core.Its overall design route is shown in Figure 4.This software contains four important functions: example input, oscillation sign quisition, oscillation signal analysis and disturbance source analysis.Among them oscillation signal acquisition part and the disturbance source analysis part are invol the GAIN in Section 3. CNN and LSTM and other deep learning technologies inv large number of computing tasks during local offline training, so TensorFlow, an source deep learning framework developed by Google, is used for development.on C++ and CUDA language, TensorFlow realizes low-level computation and p computation, which can perform large-scale matrix computation and vector compu quickly and efficiently, and facilitate the rapid construction and training of various n networks.
Further, the user interface of the oscillation analysis and oscillation source loc tion system is designed and built based on JavaScript and the CloudPSS XStudio pla As shown in Figure 5, users can upload examples on the home page of the sof and observe and analyze the topological structure and electrical parameters.The top diagram of the example and the sunburst chart of the electrical parameters are pres in an interactive form, which is convenient for users to grasp the specific informat the example.In addition, the results of oscillation analysis and oscillation source lo are reserved in the lower right corner, which is convenient for users to visually ob and analyze the relationship between calculation examples and oscillation.After importing the example, it enters the signal acquisition page, which is s Figure 6, and the user can set the start time of signal acquisition.After it starts, time measurement signal curve and the current operation status will appear on side of the interface.On the right side of the interface, users can read the pluraliti imum and minimum values of the sampling frequencies of all PMUs in the current as well as the sampling frequency of a specified PMU.Next, the reference freque interpolation method can be set according to the user's needs, and then they can Synchronize button to map the current PMU sampling frequency to the referen pling frequency for subsequent use.After importing the example, it enters the signal acquisition page, which is shown in Figure 6, and the user can set the start time of signal acquisition.After it starts, the real-time measurement signal curve and the current operation status will appear on the left side of the interface.On the right side of the interface, users can read the pluralities, maximum and minimum values of the sampling frequencies of all PMUs in the current system, as well as the sampling frequency of a specified PMU.Next, the reference frequency and interpolation method can be set according to the user's needs, and then they can click the Synchronize button to map the current PMU sampling frequency to the reference sampling frequency for subsequent use.After the PMU sampling frequency is unified, spectrum analysis can on the collected oscillation signals.This page, shown in Figure 7, will disp in the form of tables, spectrum diagrams and radar diagrams, and identify oscillation mode in the current calculation example.After the PMU sampling frequency is unified, spectrum analysis can be performed on the collected oscillation signals.This page, shown in Figure 7, will display the results in the form of tables, spectrum diagrams and radar diagrams, and identify the dominant oscillation mode in the current calculation example.After the PMU sampling frequency is unified, spectrum analysis can be pe on the collected oscillation signals.This page, shown in Figure 7, will display th in the form of tables, spectrum diagrams and radar diagrams, and identify the d oscillation mode in the current calculation example.After completing the spectrum analysis, click the Branch Potential Calculatio Oscillation Source Location page, which is shown in Figure 8, to output the p curves of each branch for analysis.Then, users can select any two of the four mo oscillation source localization to change the level of accuracy, and the results are pr in bar charts and distribution probability matrices.After completing the spectrum analysis, click the Branch Potential Calculation on the Oscillation Source Location page, which is shown in Figure 8, to output the potential curves of each branch for analysis.Then, users can select any two of the four models for oscillation source localization to change the level of accuracy, and the results are presented in bar charts and distribution probability matrices.
After the PMU sampling frequency is unified, spectrum analysis can be per on the collected oscillation signals.This page, shown in Figure 7, will display the in the form of tables, spectrum diagrams and radar diagrams, and identify the do oscillation mode in the current calculation example.After completing the spectrum analysis, click the Branch Potential Calculation Oscillation Source Location page, which is shown in Figure 8, to output the p curves of each branch for analysis.Then, users can select any two of the four mo oscillation source localization to change the level of accuracy, and the results are pr in bar charts and distribution probability matrices.

Example Introduction
In this paper, a four-machine, two-area system containing a 300 MW direct-drive wind farm is used for example verification.The topology of the system is shown in Figure 9, and PMU0 to PMU3 are installed at G1 to G4, respectively.The example is built based on the CloudPSS SimStudio platform.Different oscillation scenarios are simulated by setting parameters such as fault type, fault duration, and grounding resistance value.In each oscillation scenario, the potential energy sequence and power sequence of the four generator branches are calculated by the energy function.Then, the sequences are input into the neural network.
wind farm is used for example verification.The topology of the system is shown in Figure 9, and PMU0 to PMU3 are installed at G1 to G4, respectively.The example is built based on the CloudPSS SimStudio platform.Different oscillation scenarios are simulated by setting parameters such as fault type, fault duration, and grounding resistance value.In each oscillation scenario, the potential energy sequence and power sequence of the four generator branches are calculated by the energy function.Then, the sequences are input into the neural network.

Data Preprocessing Algorithm Validation Test
First, add different proportions of missing data to the data set of the four-machine two-area example.Further, select a variety of data restoration algorithms to interpolate the missing data, and the completed data is compared with the original.The error of data restoration results by different methods is shown in Table 1 When low-frequency oscillations occur in the system, the potential energy function of the branches near each generator is plotted and the results are shown in Figure 10.The

Data Preprocessing Algorithm Validation Test
First, add different proportions of missing data to the data set of the four-machine two-area example.Further, select a variety of data restoration algorithms to interpolate the missing data, and the completed data is compared with the original.The error of data restoration results by different methods is shown in Table 1 When low-frequency oscillations occur in the system, the potential energy function of the branches near each generator is plotted and the results are shown in Figure 10.The G1-G4 in Figure 10   As shown from Equation ( 9), when the generator power on the branch remains unchanged, the branch potential energy also remains certain.The power angle of each generator changes during oscillation, resulting in a change in output power, which means As shown from Equation ( 9), when the generator power on the branch remains unchanged, the branch potential energy also remains certain.The power angle of each generator changes during oscillation, resulting in a change in output power, which means that the oscillation starts at 3 s.
Therefore, it is shown that when the oscillation occurs, the potential energy of the branches 1-6-7 and 2-7 in the same area decreases to varying degrees.However, the potential energy of the 2-12-11 and 4-11 lines has not changed significantly.Therefore, it can be determined that the oscillation source is in branch 1-6-7 and branch 2-7, but the oscillation source cannot be precisely located.

The Results of Data-Driven Methods
The training process of CNN and LSTM neural networks is tested using the power sequence of the generator as the input.The training period is set to 150 and the results are shown in Figures 11 and 12, respectively.As shown from Equation ( 9), when the generator power on the branch remains unchanged, the branch potential energy also remains certain.The power angle of each generator changes during oscillation, resulting in a change in output power, which means that the oscillation starts at 3 s.
Therefore, it is shown that when the oscillation occurs, the potential energy of the branches 1-6-7 and 2-7 in the same area decreases to varying degrees.However, the potential energy of the 2-12-11 and 4-11 lines has not changed significantly.Therefore, it can be determined that the oscillation source is in branch 1-6-7 and branch 2-7, but the oscillation source cannot be precisely located.

The Results of Data-Driven Methods
The training process of CNN and LSTM neural networks is tested using the power sequence of the generator as the input.The training period is set to 150 and the results are shown in Figure 11 and Figure 12, respectively.The results above show that the accurate value does not improve with the increase in the training period and stays consistently below 0.8.It indicates that inputting the generator power sequence into the neural network is unable to pinpoint the source of oscillation.The results above show that the accurate value does not improve with the increase in the training period and stays consistently below 0.8.It indicates that inputting the generator power sequence into the neural network is unable to pinpoint the source of oscillation.

The Result of Data-driven Combined with Branch Potential Energy
The training process of CNN and LSTM neural networks is tested using the potential energy sequence of each generator branch as input.The training period is set to 50 and the results are shown in Figures 13 and 14, respectively.
The results above show that the accurate value does not improve with the increase in the training period and stays consistently below 0.8.It indicates that inputting the generator power sequence into the neural network is unable to pinpoint the source of oscillation.

The Result of Data-driven Combined with Branch Potential Energy
The training process of CNN and LSTM neural networks is tested using the potential energy sequence of each generator branch as input.The training period is set to 50 and the results are shown in Figure 13 and Figure 14, respectively.The results above show that the accurate value does not improve with the increase in the training period and stays consistently below 0.8.It indicates that inputting the generator power sequence into the neural network is unable to pinpoint the source of oscillation.

The Result of Data-driven Combined with Branch Potential Energy
The training process of CNN and LSTM neural networks is tested using the potential energy sequence of each generator branch as input.The training period is set to 50 and the results are shown in Figure 13 and Figure 14, respectively.The loss values converged to 0.006 for CNN and 0.04 for LSTM and the accurate values of both models converged to 1.It indicates that combining the branching potential function with the data-driven method resulted in a substantial improvement in the localization of the oscillating source.It takes 1.8980 ms to realize the source identification on the core processor of Intel I7 12900K and the graphics card of Nvidia RTX 3080.
In order to further verify the validity of the proposed data-driven-mechanism fusion power system oscillation source localization method, the IEEE-39 test system shown in Figure 15 [28] is considered in the case studies.
ization of the oscillating source.It takes 1.8980 ms to realize the source id the core processor of Intel I7 12900K and the graphics card of Nvidia RTX 3 In order to further verify the validity of the proposed data-driven-mec power system oscillation source localization method, the IEEE-39 test sys Figure 15 [28] is considered in the case studies.The training period is set to 500 and other test conditions remain unchanged.The test results are shown in Figures 16 and 17, respectively.The loss values converged to 0.0181 for CNN and 0.0894 for LSTM and the accurate values of both models converged to 1, too.It proves that our proposed method remains efficient and accurate in more complex power systems.
ization of the oscillating source.It takes 1.8980 ms to realize the source identification the core processor of Intel I7 12900K and the graphics card of Nvidia RTX 3080.
In order to further verify the validity of the proposed data-driven-mechanism fu power system oscillation source localization method, the IEEE-39 test system show Figure 15 [28] is considered in the case studies.From Figures 13 and 14, it is shown that the accurate value of the CNN converges to 1 in about 20 training cycles, while the accurate value of the LSTM converges to 1 in about 30 training cycles.Therefore, it is concluded that the CNN is more effective than the LSTM.
In addition, the two results can be cross-validated for comparison and confidence analysis, which is helpful in confirming the accuracy and reliability of localization.The localization results and reliability indexes are shown in Table 2 below.The results of the two methods are consistent.It determines that the oscillation source is at PMU0.

Conclusions
In this paper, a digital twin-based solution for power system oscillation source localization is proposed in response to the complex oscillation problems occurring in new power systems.It meets the real-time monitoring and fault localization needs of the power system.A data repair method based on a GAIN network and a measurement method of oscillation samples based on super-resolution technology are designed, respectively.They solve the problems of missing data and low and inconsistent sampling frequency of measurement devices in the actual power system.An intelligent localization algorithm for the oscillation source is constructed by combining the branch potential function and the datadriven fusion.Additionally, the corresponding data-driven localization algorithm is matched for different oscillation modes.They realize the fast and accurate localization of the oscillation source.

Figure 1 .
Figure 1.Digital Twin Framework for Power Systems.

Figure 1 .
Figure 1.Digital Twin Framework for Power Systems.
Electronics 2023, 12, x FOR PEER REVIEW 9 of 18 normalized and transformed into the reliability; finally, the weighted average is used to obtain the final probability of the distribution of the oscillation sources.

Figure 4 .
Figure 4. Systematic frame structure of the power system oscillation localization system.

Figure 4 .
Figure 4. Systematic frame structure of the power system oscillation localization system.This software contains four important functions: example input, oscillation signal acquisition, oscillation signal analysis and disturbance source analysis.Among them, the oscillation signal acquisition part and the disturbance source analysis part are involved in the GAIN in Section 3. CNN and LSTM and other deep learning technologies involve a large number of computing tasks during local offline training, so TensorFlow, an open-source deep learning framework developed by Google, is used for development.Based on C++ and CUDA language, TensorFlow realizes low-level computation and parallel computation, which can perform large-scale matrix computation and vector computation quickly and efficiently, and facilitate the rapid construction and training of various neural networks.Further, the user interface of the oscillation analysis and oscillation source localization system is designed and built based on JavaScript and the CloudPSS XStudio platform.As shown in Figure5, users can upload examples on the home page of the software and observe and analyze the topological structure and electrical parameters.The topology diagram of the example and the sunburst chart of the electrical parameters are presented in an interactive form, which is convenient for users to grasp the specific information of the example.In addition, the results of oscillation analysis and oscillation source location are reserved in the lower right corner, which is convenient for users to visually observe and analyze the relationship between calculation examples and oscillation.

Figure 5 .
Figure 5. Disturbance source location system home page.

Figure 5 .
Figure 5. Disturbance source location system home page.

Figure 9 .
Figure 9. Topology of the four-machine, two-area system.

Figure 9 .
Figure 9. Topology of the four-machine, two-area system.

Figure 10 .
Figure10.The branch potential energy of the low-frequency oscillation example.

Figure 10 .
Figure10.The branch potential energy of the low-frequency oscillation example.

Figure 10 .
Figure 10.The branch potential energy of the low-frequency oscillation example.

Figure 11 .
Figure 11.CNN loss value and accurate value curve under data-driven methods.(a) loss value curve.(b) accurate value curve.

Figure 11 .Figure 12 .
Figure 11.CNN loss value and accurate value curve under data-driven methods.(a) loss value curve.(b) accurate value curve.OR PEER REVIEW 14 of 18

Figure 12 .
Figure 12.LSTM loss value and accurate value curve under data-driven methods.(a) loss value curve.(b) accurate value curve.

Figure 13 .Figure 13 .
Figure 13.CNN loss value and accurate value curve under data-driven combined with branch potential energy method.(a) loss value curve.(b) accurate value curve.

Figure 13 .Figure 14 .
Figure 13.CNN loss value and accurate value curve under data-driven combined with branch potential energy method.(a) loss value curve.(b) accurate value curve.

Figure 16 .Figure 17 .
Figure 16.CNN loss value and accurate value curve under data-driven combined with branch potential energy method, take 39 as an example.(a) loss value curve.(b) accurate value curve.

Table 1 .
. The MSE (Mean Square Error) and DTW (Dynamic Time Warping) indicators can measure the data repair accuracy from different angles.It is shown from Table 1 that among the four repair algorithms, MSE and DTW of GAIN repair results are both the smallest.It indicates that GAIN has the best repair performance.Comparison of different repair methods.Oscillator Source Localization Algorithm Performance Validation Test 5.3.1.The Results of Localization Based on Branch Potential Energy Function

Table 1 .
. The MSE (Mean Square Error) and DTW (Dynamic Time Warping) indicators can measure the data repair accuracy from different angles.It is shown from Table 1 that among the four repair algorithms, MSE and DTW of GAIN repair results are both the smallest.It indicates that GAIN has the best repair performance.Comparison of different repair methods.Oscillator Source Localization Algorithm Performance Validation Test 5.3.1.The Results of Localization Based on Branch Potential Energy Function

Table 2 .
Functional validation of cross-validation methods.