simulhope_stats

PURPOSE ^

$Id: simulhope_stats.m,v 1.4 2004/07/16 19:26:37 dalai Exp $

SYNOPSIS ^

function stats = simulhope_stats(par,bs,mob,msg_mcn,msg_std)

DESCRIPTION ^

 $Id: simulhope_stats.m,v 1.4 2004/07/16 19:26:37 dalai Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % $Id: simulhope_stats.m,v 1.4 2004/07/16 19:26:37 dalai Exp $
0002 
0003 %function [pdf_delay_std,pdf_delay_mcn,cdf_delay_std,cdf_delay_mcn,msg_delivered,msg_delivered_percentage,max_nb_hop,hop_dist_percentage,buffer_self,buffer_mcn,buffer_std] = simulhope_stats(par,bs,mob,msg_mcn,msg_std)
0004 
0005 function stats = simulhope_stats(par,bs,mob,msg_mcn,msg_std)
0006 
0007 % extract the relative delay for each message
0008 relative_delay_std = [msg_std.time_delivered] - [msg_std.init_time];
0009 relative_delay_mcn = [msg_mcn.time_delivered] - [msg_mcn.init_time];
0010 
0011 % compute the pdf of the relative delay for the messages delivered
0012 stats.pdf_delay_std = histc(relative_delay_std(find(isnan([msg_std.time_delivered])==0)),[0:par.tmax]);
0013 stats.pdf_delay_mcn = histc(relative_delay_mcn(find(isnan([msg_mcn.time_delivered])==0)),[0:par.tmax]);
0014 
0015 % compute the cdf of the relative delay for the messages delivered
0016 stats.cdf_delay_std = cumsum(stats.pdf_delay_std)./par.msg;
0017 stats.cdf_delay_mcn = cumsum(stats.pdf_delay_mcn)./par.msg;
0018 
0019 % compute the number of messages delivered
0020 stats.std_delivered = size(find(isnan([msg_std.time_delivered])==0),2);
0021 stats.mcn_delivered = size(find(isnan([msg_mcn.time_delivered])==0),2);
0022 
0023 % compute the number of messages non delivered
0024 stats.std_dropped = size(find(isnan([msg_std.time_delivered])==1),2);
0025 stats.mcn_dropped = size(find(isnan([msg_mcn.time_delivered])==1),2);
0026 
0027 stats.msg_delivered = [stats.std_delivered stats.std_dropped; stats.mcn_delivered stats.mcn_dropped];
0028 stats.msg_delivered_percentage = stats.msg_delivered./par.msg;
0029  
0030 % select only the messages delivered and compute the number of hops for each messages
0031 hop_nb_tmp = [msg_mcn.nbr_hop];
0032 stats.max_nb_hop = max(hop_nb_tmp);
0033 hop_nb = hop_nb_tmp(find(~isnan([msg_mcn.time_delivered])));
0034 stats.hop_dist = histc(hop_nb,[0:stats.max_nb_hop]);
0035 stats.hop_dist_percentage = stats.hop_dist./stats.mcn_delivered;
0036 
0037 stats.buffer_self = reshape([mob.buffer_self],par.tmax,par.mob);
0038 stats.buffer_mcn = reshape([mob.buffer_mcn],par.tmax,par.mob);
0039 stats.buffer_std = reshape([mob.buffer_std],par.tmax,par.mob);
0040 
0041 
0042 
0043 %  %  % compute the cdf
0044 %  %  cdf = cumsum(pdf)./par.msg;
0045 %  %      maxbuffer_cdf(cov,1:2001) = cumsum(maxbuffer_pdf(cov,1:2001))./100;
0046 %  %
0047 %  %  % extract the time at which the message are delivered
0048 %  %  time_deliver = struct2array(rmfield(msg,{'init_time' 'init_mob' 'nbr_hop'}));
0049 %  %  % extract the number of hops performed for each messages
0050 %  %  temp_nb_hop = struct2array(rmfield(msg,{'init_time' 'init_mob' 'time_delivered'}));
0051 %  %  % select only the messages delivered and get their number of hops
0052 %  %  hop_nb = temp_nb_hop(find(~isnan(time_deliver)));
0053 %  %
0054 %  %  % extract the maximum buffer recorded
0055 %  %  maxbuffer = struct2array(rmfield(mob,{'xy' 'msg' 'vstate' 'v'}));
0056 
0057 
0058 % -------
0059 % function stats = simulhope_stats(par,bs,mob,msg)
0060 
0061 %  par.tdx = [1:par.tmax];
0062 
0063 %  % realtive delay stats
0064 %  [stats.delay,stats.delay_pdf,stats.delay_cdf,stats.msg_delivered,stats.msg_dropped] = stat_delay(par,msg);
0065 %
0066 %  % hops stats
0067 %  [stats.hop_nb] = stat_hops(par,msg);
0068 %
0069 %  % memory/buffer stats
0070 %  [stats.maxbuffer] = stat_buffer(par,mob);

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