# Structural Methodologies for Distributed Fault Detection and Isolation
## 4 Equation-Based Distributed Fault Detection and Isolation
### Equation-Based Fault Detection Approach  
Given a minimal set of required shared variables, we present our proposed approach to find a minimal set of equations from the neighboring subsystems in order to achieve the maximum possible fault detectability. The procedure is illustrated by solving this problem for subsystem \(S_{2}\), presented in Equation (2), of the running example, and then generalizing this approach by developing a general algorithm to solve this problem. **Example 8**. : _The corresponding structural decomposition of \(S_{2}\) is shown in Figure 5._  
_Subsystem \(S_{2}\) is just determined; therefore, none of the faults are locally detectable. However, \(q_{1}\) and \(p_{2}\) are shared variables with subsystem \(S_{1}\), and \(q_{3}\) and \(p_{3}\) are shared variables with \(S_{3}\). Algorithm 3 finds \(V_{1m}=\{q_{1},p_{3}\}\) as a minimal set of shared unknown variables, which if transferred from neighboring subsystems, can provide maximum detectability performance.Therefore, to make \(f_{3}\) and \(f_{4}\) locally detectable, the neighboring subsystems are explored to find equations that make the variables \(q_{1}\) and \(p_{3}\) known._  
_To find a minimal set of just determined equations that includes \(q_{1}\), we start with all equations in \(S_{1}\) that have \(q_{1}\). These equations are \(e_{1}\), \(e_{2}\), and \(e_{6}\), as is shown in Figure 6._  
_Then, for the additional variables in each equation that are not already in \(S_{2}^{0}\), additional equations are included. For equation \(e_{1}\), two additional equations are needed, one with \(q_{\mathit{in1}}\) and the other one with \(\dot{p_{1}}\). Finally, another equation is needed where \(p_{1}\) is included. Since \(p_{2}\in{S_{2}}^{0}\), the variable is not considered in this step._  
Figure 5: DM decomposition of \(S_{2}\). To find the other minimal sets in the example, we keep adding the relative equations to the other sets using the same approach described above. As is shown in Figure 6, by sequentially adding equations to the system, we eventually achieve four sets of minimal constraints: \(A_{2}=\{e_{1},e_{2},e_{3},e_{4}\}\), \(A_{3}=\{e_{1},e_{3},e_{4},e_{5}\}\), \(A_{4}=\{e_{2},e_{5}\}\), and \(A_{5}=\{e_{6}\}\). Figure 6 represents a matching algorithm. In the previous work in [28], a matching algorithm was introduced for finding a minimal set of equations for detecting each discrete mode change during the hybrid system's operation. In this paper, a similar approach was applied to find a minimal set of equations from neighboring subsystems for computing each required shared variable as presented as Algorithm 4. ```
1:input: current matching \(\mathcal{M}\)
2:input: sets of determined variables \(\mathcal{D}\) and undetermined variables \(\mathcal{U}\), set of equations \(E\)
3:if\(U=\mathcal{O}\)then
4:return\(\mathcal{M}\) as a feasible (minimal) matching. 5:for each \(x\in\mathcal{U}\)do
6:for each \(e\in E\), which can determine \(x\)do
7: Let \(\mathcal{M}^{\prime}\) be \(\mathcal{M}\cup\{e\to x\}\)
8: Let \(\mathcal{D}^{\prime}\) be \(\mathcal{D}\cup\{x\}\). 9: Let \(\mathcal{U}^{\prime}\) be \(\mathcal{U}\setminus\{x\}\). 10: Let \(E^{\prime}\) be \(E\setminus\{e\}\). 11: Add all the undetermined variables of \(e\) to \(\mathcal{U}^{\prime}\). 12:Count-Matchings\((\mathcal{M}^{\prime},\mathcal{D}^{\prime},\mathcal{U}^{\prime},E^{\prime})\)
```  
**Algorithm 4** Count matchings. If we initialize the algorithm with the set of unknown variables (in Figure 6, \(q_{1}\) is the unknown variable), this provides a set of complete matching of variables and equations in the neighboring subsystems that includes the unknown variables. **Example 9**. : _Figure 7 shows that augmenting \(A_{2}\) with \(S_{2}\) makes \(f_{3}\) detectable. To make \(f_{4}\) locally detectable as well, Algorithm 4 is used to find a minimal set of equations in the neighboring subsystems that includes \(p_{3}\) and augment \(S_{2}|A_{2}\) with those equations._  
Figure 6: Finding the minimal sets of equations in \(S_{1}\) to compute \(q_{1}\).