|
|
Algorithm 5. PDACAS_Sensor_Aggregate. |
|
|
Input: |
| Dj; BITj; biti; Sj; raw data di; keyed values
, 1 ≤ j ≤ q
|
|
Output: |
| Altered Dj and BITj
|
|
Method: |
| 1. ci = ci + 1; |
| 2. if ci = 3 |
| transmit Dj to the cell header CHj; |
| return |
| 3. if ci = 1 |
| 3.1 for (int k = 1; k <= p; k++) |
| if both the kth bit of BITj and biti are 1s |
|
|
| Set the kth bit of BITj to be 0; |
| else if the kth bit of biti is 1 |
|
|
| Set the kth bit of BITj to be 1; |
| 3.2 Dj = Dj + di; |
| 3.3 transmits Dj and BITj to the successor; |
| 3.4 return |
| 4. if ci = 2 |
| 4.1 for (int k = 1; k <= p; k++) |
| if both the kth bit of BITj and biti are 1s |
| Dj = Dj −
; |
| Set the kth bit of BITj to be 0; |
| 4.2 transmits Dj and BITj to the successor; |
| 4.3 return |
|