# Efficient Resource Scheduling for Multipath Retransmission over Industrial WSAN Systems
## 4 The Proposed Scheduling
### CEM-RM Algorithm
```
1 Initialize \(C_{t}\gets C,\Psi_{t}\leftarrow\Psi,t\in[0,|H|-1]\;F^{\prime}\gets ASort(F,p_{k})\); Input:\(G,F,\Psi\) Output:\(H[t][c]\), SCH or UNSCH for each \(F_{k}\in F^{\prime}\)do
2\((X_{k},E_{k})\leftarrow\mathit{Transmission}\mathit{Release}(F_{k})\);
3\(t\gets 0,\tau\gets 1,W\leftarrow\emptyset,temp\leftarrow\tau\);
4\(q\) represents all the integers within \([0,T/p_{k})\);
5 while\(X_{k}\
eq\emptyset\)do
6 if\(t>p_{k}/\kappa\)then
7 returnUNSCH;
8 if\(\tau\
eq temp\wedge\exists e(\mu+\tau)\in E_{k}\)then
9\(temp\leftarrow\tau\);
10\(\mu\leftarrow\mu^{\prime}\mid max(\mu^{\prime}+\tau),e(\mu^{\prime},\tau)\in E _{k}\);
11\(t\leftarrow\omega_{\mu}+1,\omega_{\mu}\in W\);
12
13 if\(s_{\beta}\
ot\in\{s_{\tau},d_{\tau}\}\wedge s_{\tau}\
otin\{s_{\beta},d_{\beta }\}\wedge|C_{t}|>0\), \(x^{k_{1}}(s_{\beta},d_{\beta})\in\Omega_{t+q\cdot p_{k}}\)then
14 if\(d_{\tau}=d_{\beta}\)then
15 if\(k=k_{1}\wedge d_{\tau}\in\Psi\wedge|\Psi_{t}|>0\)then
16\(d_{\tau}\gets sk,sk\in\Psi_{t}\);
17\(Del(sk,\Psi_{t+q\cdot p_{k}})\)
18 elseif\(k=k_{1}\wedge e(\beta,\tau)\
ot\in E_{k}\)then
19\(c\gets c^{\prime}\mid H[t][c^{\prime}]=x^{k}(s_{\beta},d_{\beta})\);
20 Change \(H[t][c]\) to CES;
21 else
22\(t\gets t+1\);
23 Continue;
24\(H[t][c]=x^{k}(s_{\tau},d_{\tau}),c\in C_{t}\);
25\(Del(x^{k}(s_{\tau},d_{\tau}),X_{k})\);
26\(Add(x^{k}(s_{\tau},d_{\tau}),\Omega_{t+q\cdot p_{k}})\);
27\(Del(c,C_{t+q\cdot p_{k}})\);
28\(\sigma_{\tau}\gets t;\tau\gets t+1\);
29 else
30\(t\gets t+1\);
31
32
33 returnSCH,\(H\);
```  
**Algorithm 2**CEM-RM  
The available resources are becoming more inadequate with the increase of data flow. The later scheduled flows will meet more node interferences, especially at the end hop of a flow. This is  
Figure 4: The communication resources for a hyperframe. because most transmissions share the sink node. A sink node cannot be involved in two transmissions simultaneously at a slot, which results in low schedulability. Moreover, the interference caused by one sink node makes it so that only one channel can be scheduled at the end of a hyperframe. Thus, we adopt multiple sinks to reduce the interference caused by a single sink node during hyperframe scheduling. Each slot possesses multiple available sinks to receive packets on different channels. In CEM-RM, a transmission may suffer interference at one slot, which is caused by a sink node. The algorithm will use the other available sink to avoid such interferences if at least one resource exists at the slot (line 19). Furthermore, one key adjustment for the slot employed in this paper is that we amended the common shared slot to the CES. The multipath scheme provides an alternative relay node for possible retransmissions. Actually, a packet is finally routed along one of these paths. Redundant resources need to be assigned for avoiding conflict when the different routing paths share the same relay node. Thus, merging the resources for the overlapping paths is an effective approach. However, the conflict may be caused by the DL-ACK loss problem. A packet is simultaneously transmitted along more than one path if one of the transmissions only loses a DL-ACK. The packet is still transmitted along the original path. Considering this phenomenon deteriorates the reliability and costs extra energy, we adopt an efficient approach of the CES. At a CES, the timing structure of the transmitting node is shown in Figure 5 and the destination node still accords with the standard. The main adaptation is to add CCA units (128 \(\upmu\)s) in the TsTxOffset, which is the \(2120\pm 100\)\(\upmu\)s duration between the beginning of the slot and the start of the data frame transmission. We respectively reserve 200 \(\upmu\)s and 340 \(\upmu\)s at the beginning and end of TsTxOffset for some preparation of the slot and data frame. In CCA units, we adopt CCA mode 2 in IEEE 802.15.4 standard, where CCA shall report a busy medium upon the detection of a signal with the modulation and spreading characteristics of an IEEE 802.15.4 compliant signal.