Research Article

Analysis and Design of the Battery Initial Energy Level with Task Scheduling for Energy-Harvesting Embedded Systems

Algorithm 2

WCRT-based initial energy level of battery.
Input: A⟵set of n active tasks at time t
Output: true or false
(1) function WORSTCASECALCUATION (A)
(2)  the lowest priority task of A
(3)  wt⟵WorstCaseResponseTime ()
(4)  sum⟵0
(5)  for i = 1; i < n; i++ do
(6)   task the ithtask of A as
(7)   Ei⟵energy cost of
(8)   Ti⟵period of
(9)   sum⟵Ei + sum
(10)  end for
(11)  if (wtRsum) < 0 then
(12)   if
(13)    return
(14)   else
(15)    return
(16)   end if
(17)  end if
(18) end function
(19) function SCHEDULABILITYJUDGMENT
(20)  ivi⟵WorstCaseCalcuation (A)
(21)  set iviand task set A and execute schedule algorithm
(22)  if Scheduling algorithm is schedulable then
(23)   return true
(24)  else
(25)   return false
(26)  end if
(27) end function