0001
0002 function stat_convert_results(model,nb_mob,nb_simu)
0003
0004 error = '';
0005
0006 path2results = '/home/dalai/public_html';
0007 unix('mkdir temp');
0008 root = '.';
0009
0010 res.models = { 'street' 'city' 'hexagonal' };
0011 res.model = char(res.models(model));
0012
0013 res.mob = nb_mob;
0014 unix(['mkdir ',sprintf('%s',res.model)]);
0015 unix(['mkdir ',sprintf('%s/%dusr',res.model,res.mob)]);
0016
0017 for cov = 1:20
0018 res.coverages = 5:5:100;
0019 res.coverage = res.coverages(cov);
0020
0021 for simu = 1:nb_simu
0022 disp([res.model ' ' num2str(res.mob) ' users ' num2str(res.coverage) '% coverage simulation ' num2str(simu) ' : processing ']);
0023 archive_path = [path2results,sprintf('/%s/%dusr/%d/%s-60min-%02dcov-%dusr-stat.tar.gz',res.model,res.mob,simu,res.model,res.coverage,res.mob)];
0024 untar_cmd = ['cd ',root,'/temp; tar -xvzf ',archive_path];
0025 [s,w] = unix(untar_cmd);
0026 if ( s == 0 )
0027 matfile = sprintf([root,sprintf('/temp/%s-60min-%02dcov-%dusr-stat.mat',res.model,res.coverage,res.mob)]);
0028 load(matfile);
0029 rm_cmd = ['rm ',matfile];
0030 unix(rm_cmd);
0031
0032 pdf_delay_mcn(:,simu) = stats.pdf_delay_mcn';
0033 pdf_delay_std(:,simu) = stats.pdf_delay_std';
0034
0035 temp_mcn_delivered(simu) = stats.mcn_delivered;
0036 temp_std_delivered(simu) = stats.std_delivered;
0037
0038 msg(simu) = par.msg;
0039
0040 temp_max_nb_hop(simu) = stats.max_nb_hop;
0041 temp_hop_dist(:,simu) = zeros(1,40)';
0042 for itest = 1:size(stats.hop_dist,2)
0043 temp_hop_dist(itest,simu) = stats.hop_dist(itest);
0044 end
0045
0046 temp_buffer_mcn_max_mean(simu) = mean(max(stats.buffer_mcn));
0047 temp_buffer_mcn_max_std(simu) = std(max(stats.buffer_mcn));
0048
0049 temp_buffer_mcn_mean_mean(simu) = mean(mean(stats.buffer_mcn));
0050 temp_buffer_mcn_mean_std(simu) = std(mean(stats.buffer_mcn));
0051
0052 temp_buffer_std_max_mean(simu) = mean(max(stats.buffer_std));
0053 temp_buffer_std_max_std(simu) = std(max(stats.buffer_std));
0054
0055 temp_buffer_std_mean_mean(simu) = mean(mean(stats.buffer_std));
0056 temp_buffer_std_mean_std(simu) = std(mean(stats.buffer_std));
0057
0058 clear par stats
0059 elseif ( s ~= 0 )
0060 disp(['untargzing ', archive_path,' failed !!']);
0061 error = [error; archive_path];
0062 return
0063 end
0064 end
0065
0066 cdf_delay_mcn = (cumsum(sum(pdf_delay_mcn,2)))./sum(msg);
0067 cdf_delay_std = (cumsum(sum(pdf_delay_std,2)))./sum(msg);
0068
0069 mcn_delivered = sum(temp_mcn_delivered)/sum(msg);
0070 std_delivered = sum(temp_std_delivered)/sum(msg);
0071
0072 max_nb_hop = max(temp_max_nb_hop);
0073 hop_dist = sum(temp_hop_dist,2)./sum(temp_mcn_delivered);
0074
0075 buffer_mcn_max_mean(cov) = mean(temp_buffer_mcn_max_mean);
0076 buffer_mcn_max_std(cov) = mean(temp_buffer_mcn_max_std);
0077
0078 buffer_mcn_mean_mean(cov) = mean(temp_buffer_mcn_mean_mean );
0079 buffer_mcn_mean_std(cov) = mean(temp_buffer_mcn_mean_std);
0080
0081 buffer_std_max_mean(cov) = mean(temp_buffer_std_max_mean);
0082 buffer_std_max_std(cov) = mean(temp_buffer_std_max_std);
0083
0084 buffer_std_mean_mean(cov) = mean(temp_buffer_std_mean_mean);
0085 buffer_std_mean_std(cov) = mean(temp_buffer_std_mean_std);
0086
0087 save('pdf-delay-mcn.dat','pdf_delay_mcn','-ascii','-tabs');
0088 save('pdf-delay-std.dat','pdf_delay_std','-ascii','-tabs');
0089 save('msg.dat','msg','-ascii','-tabs');
0090 save('cdf-delay-mcn.dat','cdf_delay_mcn','-ascii','-tabs');
0091 save('cdf-delay-std.dat','cdf_delay_std','-ascii','-tabs');
0092 save('mcn-delivered.dat','mcn_delivered','-ascii','-tabs');
0093 save('std-delivered.dat','std_delivered','-ascii','-tabs');
0094 save('max-nb-hop.dat','max_nb_hop','-ascii','-tabs');
0095 save('hop-dist.dat','hop_dist','-ascii','-tabs');
0096
0097 unix(['mkdir ',sprintf('%s/%dusr/%02dcov',res.model,res.mob,res.coverage)]);
0098 unix(['mv pdf-delay-*.dat msg.dat cdf-delay-*.dat *-delivered.dat max-nb-hop.dat hop-dist.dat ',sprintf('%s/%dusr/%02dcov',res.model,res.mob,res.coverage)]);
0099 clear pdf_delay_mcn pdf_delay_std msg temp_mcn_delivered cdf_delay_mcn temp_std_delivered cdf_delay_std msg mcn_delivered std_delivered temp_max_nb_hop max_nb_hop temp_hop_dist hop_dist temp_*
0100 end
0101
0102 unix('rmdir temp');
0103
0104 save('buffer-mcn-max-mean.dat','buffer_mcn_max_mean','-ascii','-tabs');
0105 save('buffer-mcn-max-std.dat','buffer_mcn_max_std','-ascii','-tabs');
0106
0107 save('buffer-mcn-mean-mean.dat','buffer_mcn_mean_mean','-ascii','-tabs');
0108 save('buffer-mcn-mean-std.dat','buffer_mcn_mean_std','-ascii','-tabs');
0109
0110 save('buffer-std-max-mean.dat','buffer_std_max_mean','-ascii','-tabs');
0111 save('buffer-std-max-std.dat','buffer_std_max_std','-ascii','-tabs');
0112
0113 save('buffer-std-mean-mean.dat','buffer_std_mean_mean','-ascii','-tabs');
0114 save('buffer-std-mean-std.dat','buffer_std_mean_std','-ascii','-tabs');
0115
0116
0117 unix(['mv buffer-*.dat ',sprintf('%s/%dusr/',res.model,res.mob)]);
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137