stat_delay

PURPOSE ^

computes stats for the delay

SYNOPSIS ^

function [relative_delay,pdf,cdf,delivered,dropped] = stat_delay(par,msg)

DESCRIPTION ^

 computes stats for the delay

 $Id: stat_delay.m,v 1.5 2004/05/12 15:13:22 dalai Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % computes stats for the delay
0002 %
0003 % $Id: stat_delay.m,v 1.5 2004/05/12 15:13:22 dalai Exp $
0004 
0005 function [relative_delay,pdf,cdf,delivered,dropped] = stat_delay(par,msg)
0006 
0007 % compute the relative delay for each message
0008 relative_delay = (struct2array(rmfield(msg,{'init_time' 'init_mob' 'nbr_hop'}))-struct2array(rmfield(msg,{'time_delivered' 'init_mob' 'nbr_hop'})));
0009 
0010 % compute the pdf
0011 tdx = [1:par.tmax];
0012 for idx=1:length(tdx)
0013     temp1 = relative_delay(relative_delay(:)>=tdx(idx)-1);
0014     temp2 = temp1(temp1(:)<tdx(idx));
0015     pdf(tdx(idx)) = size(temp2,2);
0016 end
0017 
0018 % compute the cdf
0019 cdf = cumsum(pdf)./par.msg;
0020 
0021 % compute the number of messages delivered
0022 delivered = sum(pdf);
0023 
0024 % compute the number of messages non delivered
0025 dropped = size(relative_delay(isnan(relative_delay(:))),2);
0026

Generated on Sun 15-Aug-2004 22:13:10 by m2html © 2003