Exemple #1
0
def main():

    #parse the command-line arguments
    parseArgs(sys.argv[1:])

    #AvroraLib.compileNesCCode("/cygdrive/c/dias-mc/work2/SNEEql-test/output/Q3test/nesc");

    #AvroraLib.generateODs("/cygdrive/c/dias-mc/work2/SNEEql-test/output/Q3test/nesc")

    #AvroraLib.runSimulation("/cygdrive/c/dias-mc/work2/SNEEql-test/output/Q3test/nesc", "/cygdrive/c/tmp/output", "Q0test", 10, simulationDuration=20);

    print AvroraLib.computeEnergyConsumed("/cygdrive/c/tmp/output")
Exemple #2
0
def addtoEnergyGraphs(yValue,xValue,inputfile):
	global totalGraph, averageGraph, maxGraph, lifetimeGraph, radioGraph, cpu_cycleGraph, packetGraph, energyGraph, logger

	print'************ Adding '+str(xValue)
	
	#Get the nergy used
	totalEnergy, maxEnergy, averageEnergy, radioEnergy, cpu_cycleEnergy, sensorEnergy, otherEnergy = AvroraLib.computeEnergyConsumed(inputfile)
	packetCount = AvroraLib.getPacketCount()
	workingEnergy = AvroraLib.getWorkingEnergy()
			
	#add point to the graphs
	totalGraph.addPoint(yValue,xValue,str(totalEnergy),logger)
	logger.info('yValue= '+str(yValue)+' xValue= '+str(xValue) +' total energy= '+str(totalEnergy))
	
	maxGraph.addPoint(yValue,xValue,str(maxEnergy),logger)
	averageGraph.addPoint(yValue, xValue, str(averageEnergy),logger)
	radioGraph.addPoint(yValue,xValue,str(radioEnergy),logger)
	cpu_cycleGraph.addPoint(yValue,xValue,str(cpu_cycleEnergy),logger)
	workingGraph.addPoint(yValue,xValue,str(workingEnergy),logger)
	
	secondLifetime = Globals.batteryEnergy / (maxEnergy/(Globals.simulationDuration)) 
	dayLifetime = secondLifetime / (24*60*60)
	lifetimeGraph.addPoint(yValue, xValue, str(dayLifetime),logger)
	packetGraph.addPoint(yValue, xValue, packetCount,logger)

	energyGraph.addPoint("Sensor",str(xValue)+str(yValue),str(sensorEnergy),logger)
	#print str(xValue)+str(yValue)+"sensorEnergy "+str(sensorEnergy)
	energyGraph.addPoint("CPU",str(xValue)+str(yValue),str(cpu_cycleEnergy),logger)
	#print str(xValue)+str(yValue)+"cpu_cyclePower "+str(cpu_cycleEnergy)
	energyGraph.addPoint("Radio",str(xValue)+str(yValue),str(radioEnergy),logger)
	#print str(xValue)+str(yValue)+"radioPower "+str(radioEnergy)
	energyGraph.addPoint("Other",str(xValue)+str(yValue),str(otherEnergy),logger)