# Fault Diagnosis System of Power Grid Based on Multi-Data Sources
## 3 Realization of Fault Diagnosis Real-Time Processing System
According to the general setting time of remote backup protections and the delays of circuit breakers, this paper sets 1.5 s as the time delay between receiving the first action protection and the initialization of the real-time processing system. Action protections that exceed this delay time value will not participate in fault diagnosis this time. All kinds of attributes and methods of classes include but are not limited to the content in Figure 2. Other attributes and methods will be defined in the corresponding chapters later. For example, the method to obtain the protection range of protection is shown in Algorithm 1. The fault description is as follows: Bus B1 fails. B1 bus protection (BP_B1) actions. Circuit breakers CB1 and CB2 trip. Circuit breaker CB4 refuses to operate. The fault is removed by the remote backup protection (RBP_L2_B3) on the B3 side of line L2. Circuit breaker CB5 trips. The action protections received by the dispatching center are BP_B1 and RBP_L2_B3, and the tripping circuit breakers are CB1, CB2 and CB5. According to the object-oriented representation method in Figure 2, B1, L1, L2, CB1, CB2, CB4, CB5, BP_B1 and RBP_L2_B3 are taken as examples for object instantiation, as shown in Tables 2 and 3. When an element fails, the protections of the faulty element itself act first to remove the fault. When related protections or circuit breakers refuse to act, the fault is removed by the backup protections of the adjacent elements, which is the embodiment of the selectivity of stage relay protection. Therefore, whether an element is faulty can be judged by its own protection and circuit breaker information and its adjacent element's backup protection and circuit breaker information. A tree structure is defined to store the topological relationship of the element waiting for diagnosis and contains relevant protection, circuit breaker information, adjacent elements and their connection relationship. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Element Name** & **B1** & **L1** & **L2** & **Protection Name** & **BP\_B1** & **RBP\_L2\_B3** \\ \hline Subclass & V\_B(Bus) & V\_L(Line) & V\_L(Line) & Subclass & BP & RBP \\ \hline Adjacency list: C & \begin{tabular}{c} \{G1:CB1, \\ L1:CB2, \\ L2:CB4\} \\ \end{tabular} & \begin{tabular}{c} \{B1:CB2, \\ B2:CB3\} \\ \end{tabular} & \begin{tabular}{c} \{B1:CB4, \\ B3:CB5\} \\ \end{tabular} & \begin{tabular}{c} The set of related \\ Circuit breakers: TB \\ \end{tabular} & \
\begin{tabular}{c} \{CB1, CB2, \\ CB4\} \\ \end{tabular} & CB5 \\ \hline Edges of C: n & 3 & 2 & 2 &
\begin{tabular}{c} Coefficient of \\ protection range: N \\ \end{tabular} & 1 & 3 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Instance representation of B1, L1, L2 and BP_B1, RBP_L2_B3. Figure 3: Simple power grid fault. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Circuit Breaker Name** & **CB1** & **CB2** & **CB4** & **CB5** \\ \hline The set of connected elements: TV & \begin{tabular}{c} [L1, B1] \\ \end{tabular} & \begin{tabular}{c} [B1, L1] \\ \end{tabular} & \begin{tabular}{c} [B1, L1] \\ \end{tabular} & \begin{tabular}{c} [L2, B3] \\ \end{tabular} \\ Opening and closing state: S & 1 & 1 & 0 & 1 \\ The set of related action & \begin{tabular}{c} BP\_B1 \\ \end{tabular} & \begin{tabular}{c} BP\_B1 \\ \end{tabular} & \begin{tabular}{c} BP\_B1 \\ \end{tabular} & \
\begin{tabular}{c} BP\_B1 \\ \end{tabular} &
\begin{tabular}{c} RBP\_L2\_B3 \\ \end{tabular} \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Instance representation of CB1, CB2, CB4 and CB5. **Definition 1**. : _Protection information connection tree: V_root. Tree = (V, E). Protection information connection tree is an attribute of V_e class. V is a finite set of electrical elements in the power grid. E is the directed connection relationship formed by the depth-first search of the power grid topology from V_root.