Algorithm 5.
1: Anomaly Based Heat Stress Detection
Input: Time series data HSCC parameters
SWS = 12 and AWS (Ws) = 3
Output: Heat-stress detection based on anomalies in Time series data
1. for i = 1 to K do
SWi = Hi+1, Hi+2, Hi+3, Hi+4, ..., Hi+n, Hi+(n+1) here n = 12 and Hi+(n+1) is the newly
added sample for the sequence
2. Arrange the sequence in ascending order
[{Hi+1, Hi+2, Hi+3, Hi+4, ..., Hi+n, Hi+(n+1)}]
3. Initialize Ws = 0;
4. Find median Q2 for [{Hi, Hi+1, Hi+2, Hi+3, Hi+4, ..., Hi+n, Hi+(n+1)}]
Using Q2 compute Q1 & Q3, IQR = Q3 - Q1
Compute Med couple MC.
5. If MC ≥ 0
[Q1 – 1.5 * exp(-4 * MC) * IQR, Q3 + 1.5 * exp(3 * MC) * IQR]
Else
[Q1 – 1.5 * exp(-3 * MC) * IQR, Q3 + 1.5 * exp(4 * MC) * IQR]
The sample that falls outside the IQR is termed as anomaly.
6. If Hi+(n+1) is an anomaly && Hi+(n+1) > max(SWi) && CTHI > MT
Then WS++
Else
Slide the window (SWi++) one step forward and go to step 2
7. If Ws != 3
SWAP ((Hi+(n+1), Hi+(n+2))) & Go to Step 3
Else
Heat stress confirmed
8. end for
Where,
MC = med_x≤Q2≤y h(xi - xj)
h(xi, xj) =
(x-Q2)(Q3-x)
Q3-Q1