Skip to main content
. 2015 Mar 3;15(3):5163–5196. doi: 10.3390/s150305163

Algorithm 2 Duty cycle algorithm.

DutyCyclePeriods ← 3,600,000, 1,800,000, 600,000, 300,000, 60,000, 10,000, 3000
AccDataCollection ← ∅
Threshold ← 0.3
Alast ← Ø
AmevaIsRunning ← true
WindowsSleep ← 0
MinWindowsSleep ← 5
DutyIndex ← 0
WinSamples ← WindowLength(WindowSize);
while AmevaIsRunning do
  while size(AccDataCollection) < WinSamples do
   AccDataCollection ← GetLastAccData()
  end while
  WindowV arV ar(AccDataCollection)
  if WindowVar < Threshold then
   AlastNoDevice
   WindowsSleepWindowsSleep + 1
   if WindowsSleep == MinWindowsSleep then
    if DutyIndex < size(DutyCyclePeriods) then
     DutyIndexDutyIndex + 1
    end if Sleep(DutyCyclePeriods[DutyIndex])
   end if
  else
   DutyIndex ← 0
  end if
end while