| Algorithm 1 Dynamic Threshold Calculation and Error Computation Algorithm | |
| 1: | PROCEDURE: Determine dynamic threshold |
| 2: | Input: Sa, n; Actual sensor data: Sa ; Number of past data: n |
| 4: | Output: Sd, Th; Standard deviation: Sd; Threshold: Th |
| 5: | for Sa = 1 : n do |
| 6: | calculate Sd; |
| 7: | Th ← Sd; |
| 8: | Return Th ; |
| 9: | Update sliding window; |
| 10 | End |
| 11: | PROCEDURE: Error calculation |
| 12: | Input: Sa, Sp, t; Actual sensor data: Sa ; Predicted sensor data: Sp; Particular instance: t |
| 13: | Output: e; Percentage Error: e |
| 14: | for Sa (t) and Sp (t) |
| 15: | calculate e; |
| 16: | Return e; |
| 17: | End |