Example #1
0
#routers = ('EpidemicRouter', 'SprayAndWaitRouter',)
#areas = ('500,500', '1000,1000', '1500,1500',)
probs = (0, 0.2, 0.4, 0.5, 0.6, 0.8, 1)
rng_max = 5

reports = ('MultiAppReport-BBC', 'MultiAppChecks-BBC', 'MessageStatsReport')
stats = ('Average_Percentage', 'Average_Success_Rate', 'delivery_prob')

for i in xrange(len(reports)):
    file = open(stats[i] + '.txt', 'w')
    file.write('prob avg ci\n')
    for prob in probs:
        del_ratio = []
        for j in xrange(1, rng_max + 1):
            fname = 'Relay_p-%.1f_t-300_%d_%s.txt' % (prob, j, reports[i])
            del_ratio.append(gs.get_stat(fname, stats[i]))

    # Average delivery ratio
        avg = gs.get_average(del_ratio)
        sd = gs.get_std_dev(del_ratio)
        ci = gs.confidence_interval_mean(rng_max, sd)

        print '%s %.2f %.4f' % (
            prob,
            avg,
            ci,
        )
        file.write(str(prob) + ' ' + str(avg) + ' ' + str(ci) + '\n')
    file.close()

file = open('Relay_Percentage.txt', 'w')
Example #2
0
apps = ('BBC', 'SportsApp', 'Weather')
rng_max = 5

reports = ('MultiAppReport', 'MultiAppChecks')
stats = ('Average_Percentage', 'Average_Success_Rate')

for i in xrange(len(reports)):
    for k in xrange(len(apps)):
        file = open(stats[i] + '-' + apps[k] + '.txt', 'w')
        file.write('priority avg ci\n')
        for priority in prioritize:
            del_ratio = []
            for j in xrange(1, rng_max + 1):
                fname = 'Priority_%s_%d_%s-%s.txt' % (priority, j, reports[i],
                                                      apps[k])
                del_ratio.append(gs.get_stat(fname, stats[i]))

    # Average delivery ratio
            avg = gs.get_average(del_ratio)
            sd = gs.get_std_dev(del_ratio)
            ci = gs.confidence_interval_mean(rng_max, sd)

            print '%s %.2f %.4f' % (
                priority,
                avg,
                ci,
            )
            file.write(str(priority) + ' ' + str(avg) + ' ' + str(ci) + '\n')
        file.close()

file = open('delivery_prob.txt', 'w')
Example #3
0
__version__ = "1.0"


import csv
import _gen_stats as gs
import math


# Routers used
routers = ('EpidemicRouter', 'SprayAndWaitRouter',)
areas = ('500,500', '1000,1000', '1500,1500',)
rng_max = 5


for router in routers:
    print '# Router', router
    for area in areas:
	    del_ratio = []
	    for i in xrange(1, rng_max+1):
		    fname = 'scenario_%s_area-%s_rng-%d_MessageStatsReport.txt' % (router, area, i,)
		    del_ratio.append(gs.get_stat(fname))

	    # Average delivery ratio
	    avg = gs.get_average(del_ratio)
	    sd = gs.get_std_dev(del_ratio)
	    ci = gs.confidence_interval_mean(rng_max, sd)

	    print '%s %.2f %.4f' % (area, avg, ci,)

    # Any two data sets for Gnuplot must be separated by exactly 2 blank lines
    print '\n'
Example #4
0
import math


# Routers used
#routers = ('EpidemicRouter', 'SprayAndWaitRouter',)
#areas = ('500,500', '1000,1000', '1500,1500',)
hosts = (21, 42, 63, 84, 105, 126)
rng_max = 5

reports = ('MultiAppReport-BBC', 'MultiAppChecks-BBC', 'MessageStatsReport.txt')
stats = ('Average_Percentage', 'Average_Success_Rate', 'delivery_prob')


for i in xrange(len(reports)):
	file = open(stats[i]+'.txt', 'w')
	file.write('host avg ci\n')
	for host in hosts:
		del_ratio = []
		for j in xrange(1, rng_max+1):
			fname = 'Density_%d-hosts_%d_%s' % (host, j, reports[i],)
			del_ratio.append(gs.get_stat(fname,stats[i]))

	    # Average delivery ratio
		avg = gs.get_average(del_ratio)
		sd = gs.get_std_dev(del_ratio)
		ci = gs.confidence_interval_mean(rng_max, sd)

		print '%s %.2f %.4f' % (host, avg, ci,)
		file.write(str(host)+' '+str(avg)+' '+str(ci)+'\n')
	file.close()
    
Example #5
0
relays = ('0', '300')
rng_max = 5

reports = ('MultiAppReport-BBC', 'MultiAppChecks-BBC', 'EnergyReport')
stats = ('Average_Percentage', 'Average_Success_Rate', 'Average_Source_Energy')

for i in xrange(len(reports)):
    for relay in relays:
        file = open(stats[i] + '_R-' + relay + '.txt', 'w')
        file.write('interface avg ci\n')
        for interface in interfaces:
            del_ratio = []
            for j in xrange(1, rng_max + 1):
                fname = 'Energy_%s_R-%s_%d_%s.txt' % (interface, relay, j,
                                                      reports[i])
                del_ratio.append(gs.get_stat(fname, stats[i]))

    # Average delivery ratio
            avg = gs.get_average(del_ratio)
            sd = gs.get_std_dev(del_ratio)
            ci = gs.confidence_interval_mean(rng_max, sd)

            print '%s %.2f %.4f' % (
                interface,
                avg,
                ci,
            )
            file.write(str(interface) + ' ' + str(avg) + ' ' + str(ci) + '\n')
        file.close()

for relay in relays:
Example #6
0
apps = 10


reports = ('MultiAppReport-App', 'MultiAppChecks-App', 'CDFRelayReport-App', 'CDFUpdateReport-App')
stats = ('Average_Percentage', 'Reject_Percentage', 'Relay_Percentage')

for x in xrange(len(flood)):
	# MultiAppReport
	for i in xrange(0, len(stats)):	
		file = open(stats[i]+'_'+scheme[x]+'_'+relay[x]+'.txt', 'w')
		file.write('sources avg max app min app\n')
		for source in sources:
			del_ratio = []
			for j in xrange(1, apps+1):
				fname = '%s_%s/S-%d/Source_S-%d_%s_F-%s_MultiAppReport-App%d.txt' % (scheme[x], relay[x], source, source, relay[x], flood[x], j)
				del_ratio.append(gs.get_stat(fname,stats[i]))

	    	# Average delivery ratio
			avg = gs.get_average(del_ratio)			
			minimum = gs.get_min(del_ratio)
			maximum = gs.get_max(del_ratio)

			print '%d %.2f %.2f App%f %f App%f' % (source, avg, maximum[0], maximum[1], minimum[0], minimum[1])
			file.write(str(source)+' '+str(avg)+' '+str(maximum[0])+' '+str(maximum[1])+' '+str(minimum[0])+' '+str(minimum[1])+'\n')
		file.close()


	file = open('Success_Rate_'+scheme[x]+'_'+relay[x]+'.txt', 'w')
	file.write('sources avg max app min app\n')
	for source in sources:
		del_ratio = []