Research Article
Analysis and Design of the Battery Initial Energy Level with Task Scheduling for Energy-Harvesting Embedded Systems
Algorithm 3
Accurate cycle-initial energy level of battery.
Input: A⟵set of active tasks at time t, sum⟵0 | Output: ture of false | (1) function CalculateInitialValue(A; sum) | (2) t⟵0 | (3) loop | (4) ⟵the first task of A | (5) Ei⟵remaining energy cost of theat time t | (6) Ci⟵remaining execution time of theat time t | (7) ifthen | (8) if Ei/Ci < E(t) + R then | (9) t⟵t + 1 | (10) end if | (11) if Ei/Ci > E(t) + R then | (12) sum⟵+sum | (13) CalculateInitialValue(A, sum) | (14) end if | (15) if Ei/Ci = R & E(t) = 0 then | (16) sum⟵sum + 1 | (17) CalculateInitialValue(A, sum) | (18) end if | (19) end if | (20) A⟵remove the first task of A | (21) end loop | (22) if result Cmaxthen | (23) return Cmax | (24) else | (25) return result | (26) end if | (27) end function | (28) function SCHEDULABILITYJUDGMENT | (29) ivi⟵CalculateInitialValue(A, sum) | (30) set the iviand task set A, and execute schedule algorithm | (31) if Scheduling algorithm is schedulable then | (32) return true | (33) else | (34) return false | (35) end if | (36) end function |
|