## 7 SMEP Algorithms
### AuxDataQueue Compression Algorithm
```
1:Parameters
201 DataQueue, Zones, ZoneBpSeq, ZoneCompHistory, Ap, AuxDataQueue: arrays or variables corresponding to SMEP main algorithm parameters Global Variables Local Variable
2:1 DQix: an index variable for DataQueue array
3:2 XINaxDQix: the maximum among indices of DataQueue space corresponding to a zone
4:3 CompZoneMax: the maximum among indices, j, such that Zones[j] is not zero
5:4 CompZoneMax: Ap: the maximum among absolute positions covered by the CompZoneMax zone
6:5 ZNix: an index variable in Zones array
7:6S\({}_{p}\), S\({}_{f}\): the leftmost and rightmost values used to recover last sensor data in an interval, [p, j]
8:7:p, i: the leftmost and rightmost absolute position used to recover lost sensor data in an interval, [p, j]
9:8 ZNCV: a value variable of ZoneCompHistory[zone, Zones[zonell].Value for some zone
10:9 ZNBP: an absolute position variable of ZoneCompHistory[zone, Zones[zonell].Position for some zone
11:Procedure
12:01 Set DQix = 0
13:2i(Zone[0]/i) 0
14:3 thenFinal CompZoneMax = max{ k | Zones[k] \(\
eq\) 0
15: Set ZNix = 0, CompZoneMaxAp = \(\sum_{j}^{j-CompZoneMax}2^{m-j-1}\)-2 Zone[j]
16: while(0 \(\leq\) ZNixr and ZNixr \(\leq\) CompZoneMax) do
17: if (ZNixr=0)
18: then Set [\(S_{p}\), \(p\)] = [DataQueue[0], 0]
19: else Set [\(S_{p}\), \(p\)] = [ZoneCompHistory[ZNixr-1, Zones[ZNixr]]
20:endif
21: if (ZNixr = \(m-1\))
22: then ZNMaxDQix = DQixr+
23: else ZNMaxDQix = DQixr+ 2^m-ZNixr-1
24:endif
25: Set DQixr = DQixr + 1
26: while (DQixr<ZNMaxDQix) do
27: Set \(j\) = DataQuQuQu[DQixr]
28: Set \(j\) = FindAbsoluteAddress(DQix, Zones, ZoneBpString)
29: SensorDataLineInterpolation(Sp, p, Sj, j)
30: Set [\(S_{p}\), \(p\)] = [\(S_{j}\), \(j\)]
31: Set DQixr = DQixr + 1
32: endwhile
33: if (ZNixr = CompZoneMax)
34: then Set [ZNCV, ZNBP] = ZoneCompHistory[ZNixr, 1]
35: else Set [ZNCV, ZNBP] = ZoneCompHistory[ZNixr, Zones[ZNixr]]
36:endif
37: if (DQixr=ZNMaxDQixr and j+ZNBP)
38: then SensorDutaiLineInterdepatation(Sj, j, ZNCV, ZNBP)
39: else Output S\({}_{j}\), \(j\)
40: endwhile
41:endif
42: if (CompZoneMax > 0 and CompZoneMax < \(m-1\) and ZNBP + CompZoneMaxAp)
43: then SensorDutaiLineInterdepatation(ZNCV, ZNBP, DataQuunet[DQixr + 1], CompZoneMaxAp + 1)
44: else if(CompZoneMax = \(m-1\) and ZNBP + CompZoneMaxAp)
45: then SensorDutaiLineInterdepatation(ZNCV, ZNBP, AuxDataQuet[1], CompZoneMaxAp + 1)
46:endif
47:endif
48: return Endprocedure
```

**Algorithm 6**_SensorDataRecovery(DataQueue, Zones, ZoneBpSeq, ZoneCompHistory, Ap, AuxDataQueue)_

The main algorithm parameters Global Variables Local Variable

1:DQix: an index variable for DataQueue array
2:ZNixr-DQix: the maximum among indices of DataQueue space corresponding to a zone
3:CompZoneMax: the maximum among indices, j, such that Zones[j] is not zero
4: CompZoneMaxAp: the maximum among absolute positions covered by the CompZoneMax zone
5:ZNixr: an index variable in Zones array
6:S\({}_{p}\), S\({}_{f}\): the leftmost and rightmost values used to recover last sensor data in an interval, [p, j]
7:p, i: the leftmost and rightmost absolute position used to recover lost sensor data in an interval, [p, j]
8:ZNCV: a value variable of ZoneCompHistory[zone, Zones[zonell].Value for some zone
9: ZNBP: an absolute position variable of ZoneCompHistory[zone, Zones[zonell].Position for some zone
10: Procedure
11: Set DQixr = 0
22:if (Zone[0]/i) 0
33: then Final CompZoneMax = max{ k | Zones[k] \(\
eq\) 0
44: Set ZNixr = 0, CompZoneMaxAp = \(\sum_{j}^{j-CompZoneMax}2^{m-j-1}\)-2 Zone[j]
5: while(0 \(\leq\) ZNixr and ZNixr \(\leq\) CompZoneMax) do
65: if (ZNixr=0)
66: then Set [\(S_{p}\), \(p\)] = [DataQueue[0], 0]
67: else Set [\(S_{p}\), \(p\)] = [ZoneCompHistory[ZNixr-1, Zones[ZNixr]]
68:endif
69:endif
70:else Set [\(ZNixr\), \(ZNixr\), \(ZNBP\)] = [ZoneCompHistory[ZNixr, Zones[ZNixr]]
71:endif
72:endif
73:else Set [\(ZNixr\), \(ZNixr\), \(ZNBP\)] = [ZoneCompHistory[ZNixr, Zones[ZNixr]]
74:endif
75:endif
76: if (DQixr=ZNixrXQixr and j+ZNBP)
77: then SensorDutaiLineInterdepatation(Sj, j, ZNCV, ZNBP)
78: else Output S\({}_{j}\), \(j\)
89:endif
90: endwhile
910:endif
92:if (CompZoneMax > 0 and CompZoneMax < \(m-1\) and ZNBP + CompZoneMaxAp)
93: then SensorDutaiLineInterdepatation(ZNCV, ZNBP, DataQuunet[DQixr + 1], CompZoneMaxAp + 1)
94: else if(CompZoneMax = \(m-1\) and ZNBP + CompZoneMaxAp)
95: then SensorDutaiLineInterdepatation(ZNCV, ZNBP, AuxDataQuet[1], CompZoneMaxAp + 1)
96:endif
97:endif
98:endif
99:endif
100:endif
11:endif
12:endif
131:endif
142



Since if the zone is the last target zone then the first sensor data of the next zone is a ground sensor, the procedure selects, as a partner of the last sensor data, the sensor data of _ZoneCompHistory_ to have the least compression 1 in that zone (procedure line 23).