# Error Recovery in the Time-Triggered Paradigm with FTT-CAN
## 5 Resource Optimization Process
### Server Interference
#### 5.3.1 Indirect Interference  
The server execution may delay the dispatching of lower priority messages, thus causing interference on them. As in this work the server is assigned with the highest priority, to minimize retransmission's latency, all messages are potentially subject to interference.  
Figure 8 illustrates the indirect interference caused by the error scenarios presented in Figure 7. Possible error sequences in consecutive cycles, including all possible error combinations of _max_Icycle_ errors that can occur in _max_cycles_ cycles, with _RepLevel_ = {3, 2, 1}, are presented there. Using a smaller number of errors reduces the server load, and consequently, the indirect interference, thus we just need to consider the combinations depicted in Figure 8.  
\begin{table}
\begin{tabular}{c c c} \hline
**LSW(ms); \(\lambda\)** & **max\_cycles** & **max\_Icycle** \\ \hline
2.5; 0.026 & 3 & 3 \\
2.5; 0.26 & 5 & 4 \\
25; 0.026 & 5 & 4 \\
25; 0.26 & 7 & 6 \\ \hline \end{tabular}
\end{table}
Table 3: Maximum consecutive cycles (max_cycles) with single error and maximum number of errors in one cycle (max_Icycle), for various values of LSW and \(\lambda\), using \(pe=10^{-16}\).  
Figure 7: Possible error sequences in consecutive cycles.  
Algorithm 3 assesses the schedulabity when considering indirect interference on message set \(M\), having as inputs _LSW_, _LEC_, \(\lambda\), _pe_, and the _RepLevel_ vector.  
The parameter _Cut_errors_ is an auxiliary variable needed to allow for this algorithm to be used both for the Indirect (\(Cut\_errors=0\)) and Direct (\(Cut\_errors=1\)) Interference computation. Lines 1-4 determine the _Interf_P_ array, required to compute the WCRT of all the messages. Firstly Algorithm 2 bounds the number of errors (per cycle and in consecutive cycles), and then the possible combinations of errors are built. Then the _Error_S_ array (the set of error scenarios) is combined with the vector _RepLevel_ to obtain _Interf_P_. This vector has size _Max_Patterns_, which corresponds to the number of error scenarios that must be analyzed. Line 5 computes the values that are needed for the non-preemptive blocking free model (Section 3.2). Lines 6-10 apply the extended schedulability test (Equation (16)) to the message set, when considering each one of the error scenarios and interference patterns. If the test fails for any of the patterns, the algorithm returns _Schedulable_ = FALSE (Line 10). Otherwise the algorithm returns _Schedulable_ = TRUE together with the response time of each message (Line 12), also expressed in number of ECs (Line 11). In fact, the timing granularity of FIT-CAN is the EC duration (LEC) and there is no guarantee on where within an EC a given message will be transmitted.  
```
Inputs:\(M\), _LEC_, _LSW_, _RepLevel_, _Cut_errors_, \(\lambda\)_pe Outputs:\(Schedulable\) (Boolean), _RespTime
```
1: Use Algorithm 2 to obtain _max_cycles_ and _max_Icycle_ in LSW
2:\(max\_cycles=max\_cycles-Cut\_errors\)
3: Build _Error_S_ array, considering _max_cycles_ and _max_Icycle_
4: Build _Interf_P_ array by combining the _Error_S_ array and _RepLevel_ vector; _Max_Patterns_ = number of _Interf_P_ lines
5: Compute _Class_ and obtain \(M^{c}_{i}\), \(C^{c}_{MAX}\) (inflate all transmission times)
6:for\(=1\)to Max_Patterns do
7:for each \(m\) in \(M\)do
8: Compute \(R\) (Equation 16) considering \(M^{c}\) and with \(Interf\_P(a,j)\times C^{c}_{MAX}\) and \(Err\_S(a,j)\times C^{c}_{error}\) being added as the cycles progress
9:if\(\text{RespTime}(i)<R\)then \(\text{RespTime}(i)=R\)
10:endif\(R\):\(>D\)thenreturnSchedulable = FALSE end_if
11:end_for
12: Transform each _RespTime_ vector value from seconds to number of ECs
13:returnSchedulable = TRUE, _RespTime
14:end_for ```
**Algorithm 3**_Ind_Interf_Response Time with Indirect Server Interference  
Figure 8: Possible error and recovery scenarios for indirect interference.