Skip to main content
. 2018 Mar 7;18(3):812. doi: 10.3390/s18030812
Algorithm 2 WSN parameter calculation. Service time
Input: Circular matrix of service time measures serv_measure
   Array number_cpo[256] of CPO to be executed
Output: Medium service time μ
Obtain the current date in Epoch format, create a variable initial_date
Create an integer pending_op equal to one
while pending_op is higher than zero then
  pending_op is equal to the addition of elements in number_cpo
  Wait for the result of an operation
  Subtract one unit to number_cpo[(int)result.CPO_ID]
  if received result is not a cancellation then
   Obtain the current date current_date in Epoch format
   Store the new measure current_date  initial_date in serv_measure in the row (int)result.CPO_ID
  end if
end while
for each server group Si do
   Integer num_measure is equal to number of non-zero elements in i-th row of serv_measure
   Acc_time is equal to the addition of all non-zero elements in i-th row of serv_measure
    μi= Acc_time /num_measure
end for