The pseudo code of the PAA Algorithm

Piecewise Aggregation divides the original data of length

better reconstruction of the original data, however more data

space is needed to store the data and eventually higher energy

consumption by higher communication costs

Suppose the following:

“D” is the list of data that containing the raw values that we will reduce it’s size,

“L” is the desired output length,

“w” is the number of equally sized windows,

“output” is the result vector of PAA function,

“p” is the pointer to the data list,

“s” is the segment.

“n” is the iterator over output vector

function PAA(L, D)

w:= length(D)/L

p=0

n=0

output[] // initialize the output vector of length L

while p < length(D) do // iterate over the

s:= D(p,p+w) //return segment of the original data of size “w”

outputn = mean(s) //calculate the mean of the segment values

p = p + w //increase the value of the pointer with value of “w”

n++ // increase the value of the output vector iterator

end while

return output // return the output vector after iterating over the data

end function