# A Reliability Scheduling Algorithm for the Static Segment of FlexRay on Vehicle Networks +
## 2 Proposed Methodology
### Proposed Fast Reliability Scheduling Algorithm  
Algorithm 1 is the proposed fast reliability scheduling algorithm (FRSA). In the beginning, each message \(M\) is computed by the \(RT_{i(\text{min})}\) and \(GS_{mi}\) (lines 1 and 2). After obtaining these two values, we have the initial global success reliability (\(GS\)).  
```
Inputs: \(M\), System reliability goal (\(SR\)); Outputs: re-transmitted times (\(RT_{i}\))
1:for each \(M_{i}\)do
2: compute \(RT_{i(\text{min})}\) and \(GS_{mi}\) end_for
3:if (Global Success Reliability \(\geqq\) System Reliability goal) then Schedulability Analysis /* \(GS\) does not meet SR, start to re-compute \(SR_{mi}\) and \(RT_{i}\) */
4:else sort \(GS_{mi}\) in descending order to obtain \(GS_{1}\) > \(GS_{2}\) > \(\ldots\) > \(GS_{n}\) (Equation (5)) end_if
5:for\(j=1\) to \(n-1\)do
6:until (\(\prod_{i=1}^{j}\left(1-PF_{i}^{RT_{i}+1}\right)^{\frac{T_{i}}{T_{i}}}\geq SR\) && \(\prod_{i=1}^{j+1}\left(1-PF_{i}^{RT_{i}+1}\right)^{\frac{T_{i}}{T_{i}}}\leq SR\)) then /* to exclude the messages that do not need to be re-transmitted */
7: TempGS = \(SR\) / \(\prod_{i=1}^{j}\left(1-PF_{i}^{RT_{i}+1}\right)^{\frac{T_{i}}{T_{i}}}\) end_for
8:for\(I=1\) to \(n\)do
9:if (\(GS_{mi}\geqq\) TempGS) then \(RT_{i}\) = \(RT_{i(\text{min})}\)
10:else re-compute \(RT_{i(\text{min})}\) and \(GS_{mi}\) using \(New\_SR_{mi}\) =TempGS end_if
11:if (Global Success Reliability < System Reliability goal)
12:for\(i\) to \(n\)do
13: re-compute \(RT_{i(\text{min})}\) and \(GS_{mi}\) with \(New\_SR_{mi}\) using lookup table method end_for end_if end_if
14:if (Global Success Reliability \(\geqq\) System Reliability goal) then Schedulability Analysis
15:else goto Line 4 end_if
16:return \(\left[RT_{1},RT_{2},\ldots,RT_{n}\right]\)
```  
**Algorithm 1** The proposed fast reliability scheduling algorithm  
As in the discussion above on the characteristics of FlexRay, \(GS\) cannot meet the system reliability goal (\(SR\)) in most transmissions; therefore, \(SR_{mi}\) and \(RT_{i}\) are re-computed with recovery mechanism. Sorting is an important step, making the procedure of re-computation more effective (Line 4).  
To achieve an efficient execution time and slot utilization, the proposed algorithm multiplies each \(GS_{mi}\) until the multiplication value does not meet \(SR\), then the _tempGS_ is used to obtain which messages have to be re-computed by the \(SR_{mi}\) and \(RT_{i}\) (Line 6 and 7). If the \(GS_{mi}\) is smaller than _tempGS_, the \(New\_SR_{mi}\) of the message is obtained from _tempGS_ according to the \(New\_SR_{mi}\) (Line 10). In some cases, \(GS\) still does not meet \(SR\), and the proposed mechanism re-computes the single message reliability goal for each message \(M\), selected according to the lookup table method, which can provide a near-optional reliability goal for the reliability of the system (Line 13). Finally, we can check whether \(GS\) is bigger than or equal to the reliability goal or not (Line 14). If true, _schedulability analysis_ processing is performed or re-computed by \(SR_{mi}\) and \(RT_{i}\) (Line 15). Based on algorithm analysis, the complexity of the proposed fast reliability scheduling algorithm is \(O(n^{2})\), where \(n\) is the number of messages.