Algorithm 1. The data quality control algorithm. |
(1) |
Dat ← getData() |
(2) |
errThred ← setErrThred() |
(3) |
L ← getWindLen(D, interval) |
(4) |
N ← getStuckThred(D, interval) |
(5) |
T ← setGapThred() |
(6) |
Dat ← delReduntant(Dat) |
(7) |
Dat ← labelStuck(Dat, N) |
(8) |
Dat ← checkContinuity(Dat, T, interval) |
(9) |
while (Dat) do |
(10) |
tbModelDat ← getDatainL(Dat, L) |
(11) |
D ← 0 |
(12) |
while (! isStationary(tbModelDat)) |
(13) |
tbModelDat ← diffData(tbModelDat) |
(14) |
D ← D + 1 |
(15) |
End while |
(16) |
[p, q] ← getBestOrder(tbModelDat, pRange, D, qRange) |
(17) |
Model ← getARIMA(tbModlDat, p, D, q) |
(18) |
predValue ← predict(Model) |
(19) |
[tdatStatus tdatValue] ← getNextTestData(Dat) |
(20) |
If (tdatStatus == missing or tdatStatus == stuck) |
(21) |
Dat ← interpolateData(predValue) |
(22) |
Dat ← setQCFlag() |
(23) |
continue |
(24) |
end if |
(25) |
If (! isInRange(tdatValue, upper, lower)) |
(26) |
Dat ← interpolateData(predValue) |
(27) |
Dat ← setQCFlag() |
(28) |
continue |
(29) |
end if |
(30) |
relErr ← errCalculator(tdatValue, predValue) |
(31) |
if (relErr > errThred) Then |
(32) |
Dat ← interpolateData(predValue) |
(33) |
Dat ← setQCFlag() |
(34) |
end if |
(35) |
end while |