Skip to main content
. 2020 Apr 16;20(8):2254. doi: 10.3390/s20082254
Algorithm 2 Re-encoding strategy
1: Intermediate node T receives a packet pkg2 from S.
2: T extracts frame number N from pkg2.
3: IfN==RFlag
4:  T discards pkg2.
5: Else
6:  T extracts row vector Pi and encoded data slice Yi from pkg2.
7:  If N==Flag
8:    r1=rank(G)
9:    r2=rank(PiG)
10:    If r2>r1 do
11:      Add Pi into matrix G.
12:      Add Pi into existing encoded data H.
13:      Count++;
14:      If Count==K
15:        Re-encode G, H and compose new data packets pkg.
16:        T sends pkg back to the network.
17:        RFlag=N
18:      Endif
19:    Endif
20:  Else
21:    Flag=N
22:     Get K from pkg2 and save the data in it
23:    Clear matrix G and encoded data H
24:    Count=0
25:  Endif
26: Endif