예제 #1
0
def doExperiment1():

	#set up the logger
	startLogger(currentExperimentRoot)

	if not os.path.isdir(currentExperimentRoot):
		os.makedirs(currentExperimentRoot)
	Globals.recordParameters(currentExperimentRoot,logger)

	setupEnergyGraphs('Acquisition interval (ms)',Globals.exp1AqRates, Globals.queries,'Max buffering factor: '+str(Globals.exp1MaxBufferingFactor))

	for aqRate in Globals.exp1AqRates:
		
		for query in Globals.queries:	
			queryInstanceRoot, queryPlanDir, nescDir, outputDir, desc = getExpDescAndDirs(currentExperimentRoot, query, 'aqRate', aqRate)

			#run the SNEEql query compiler
			SNEEqlParams = generateSNEEqlParams(Globals.queryDir+query, queryInstanceRoot, aqRate, Globals.exp1MaxBufferingFactor, sys.maxint, Globals.simulationDuration, True)

			exitVal = ExperimentLib.compileQuery(SNEEqlParams, desc, logger)
			if (exitVal != 0):
				continue

			#compile the nesC code
			if not os.path.exists(outputDir):
				os.makedirs(outputDir)
				print "made "+outputDir
			else:
				print "Exists "+outputDir

			ExperimentLib.compileNesC(nescDir, desc, logger)

			AvroraLib.runSimulation(nescDir, outputDir, desc, logger)
		
			if (os.path.exists(outputDir+'/avrora.txt')):
				addtoEnergyGraphs(query,aqRate,outputDir+'/avrora.txt')
				
			else:	
				print 'Did not find '+outputDir+'/avrora.txt'
										
	#generate the graphs
	#generateEnergyGraphs('linespoints',1,True)	
	
	energyGraph.generatePlotFile(currentExperimentRoot+'Exp1energy.txt',False, logger)
	os.chdir(currentExperimentRoot)
	energyGraph.plotFig14(Globals.gnuPlotExe, logger)
	lifetimeGraph.generatePlotFile(currentExperimentRoot+'Exp1lifetime.txt',True, logger)
	os.chdir(currentExperimentRoot)
	lifetimeGraph.plotFig15(Globals.gnuPlotExe, logger)
예제 #2
0
def testAvroraCandidate(nescDir, query, outputPath, numNodes, duration,
                        schemaPath, aqRate, deliveryTime, actualBFactor):

    #Compile the nesC
    exitVal = AvroraLib.compileNesCCode(nescDir)
    if (exitVal != 0):
        return
    AvroraLib.generateODs(nescDir)

    for i in range(0, optNumAvroraRuns):
        if optNumAvroraRuns > 1:
            report("Avrora simulation run #%d for candidate %s\n" %
                   (i, outputPath))

        #run avrora simulation
        (avroraOutputFile,
         traceFilePath) = AvroraLib.runSimulation(nescDir,
                                                  outputPath,
                                                  query,
                                                  numNodes,
                                                  simulationDuration=duration,
                                                  networkFilePath=None)

        #check all tuples present
        queryPlanSummaryFile = "%s/%s/query-plan/query-plan-summary.txt" % (
            outputPath, query)
        checkTupleCount.checkResults(query, traceFilePath, schemaPath, aqRate,
                                     actualBFactor, duration)

        #add points to graph here
        #TODO: exp dependent - deliveryTime
        if (optXValType == 'acq'):
            addtoEnergyGraphs(query, aqRate, outputPath, duration, query)
        elif (optXValType == 'del'):
            addtoEnergyGraphs(query, deliveryTime, outputPath, duration, query)
예제 #3
0
def doExperiment3():
	
	#set up the logger
	startLogger(currentExperimentRoot)

	if not os.path.isdir(currentExperimentRoot):
		os.makedirs(currentExperimentRoot)
	Globals.recordParameters(currentExperimentRoot,logger)
		
	#graph to output total energy consumed by network
	setupEnergyGraphs('Maximum result delivery time',Globals.exp3DeliveryTimes,Globals.queries,'Acquistion rate: '+str(Globals.exp3AqRate))
	
	for deliveryTime in Globals.exp3DeliveryTimes:
		
		for query in Globals.queries:	

			queryInstanceRoot, queryPlanDir, nescDir, outputDir, desc = getExpDescAndDirs (currentExperimentRoot, query, 'deliveryTime', deliveryTime)
			
			#run the SNEEql query compiler
			SNEEqlParams = generateSNEEqlParams(Globals.queryDir+query, queryInstanceRoot, Globals.exp3AqRate, sys.maxint, deliveryTime, Globals.simulationDuration, True)

			exitVal = ExperimentLib.compileQuery(SNEEqlParams, desc, logger)
			if (exitVal != 0):
				continue

			#compile the nesC code
			if not os.path.exists(outputDir):
				os.makedirs(outputDir)
				print "made "+outputDir
			else:
				print "Exists "+outputDir
			ExperimentLib.compileNesC(nescDir, desc, logger)

			AvroraLib.runSimulation(nescDir, outputDir, desc, logger)
			
			if (os.path.exists(outputDir+'/avrora.txt')):
				addtoEnergyGraphs(query,deliveryTime,outputDir+'/avrora.txt')
						
			else:	
				print 'Did not find '+outputDir+'/avrora.txt'	
					
	lifetimeGraph.generatePlotFile(currentExperimentRoot+'Exp3lifetime.txt',True,logger)
	os.chdir(currentExperimentRoot)
	lifetimeGraph.plotFig17(Globals.gnuPlotExe, logger)		
예제 #4
0
def dotest(query, bufferingFactor, measurementsActiveAgendaLoops,
           measurementsIgnoreIn, measurementsRemoveOperators,
           measurementsThinOperators, measurementsMultiAcquire,
           removeUnrequiredOperators):
    global outputPath

    testName = runDir(bufferingFactor, measurementsActiveAgendaLoops,
                      measurementsIgnoreIn, measurementsRemoveOperators,
                      measurementsThinOperators, measurementsMultiAcquire,
                      removeUnrequiredOperators)
    outputPath = optOutputRoot + testName + "/"
    report("DoTest to: " + outputPath)

    if optCompileQuery:
        queryDir = outputPath + "/" + str(query)
        report("Running: " + queryDir)
        if os.path.isdir(queryDir):
            if not (SneeqlLib.optDeleteOldFiles):
                report("Reusing " + queryDir)
                copyFiles(queryDir, measurementsActiveAgendaLoops)
                return
        outputPath = compileInput(
            outputPath, query, bufferingFactor, measurementsActiveAgendaLoops,
            measurementsIgnoreIn, measurementsRemoveOperators,
            measurementsThinOperators, measurementsMultiAcquire,
            removeUnrequiredOperators)
    else:
        copyInput(outputPath)

    report("Outpath = " + outputPath)

    if (optCompileNesc):
        exitVal = AvroraLib.compileNesCCode(outputPath)
        if (exitVal != 0):
            return
        AvroraLib.generateODs(outputPath)
        print "complied"
    else:
        print 'reusing existing Nesc and od files'

    numNodes = getMaxMote(outputPath)
    desc = "test"
    #run avrora simulation
    (avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(
        outputPath,
        outputPath,
        desc,
        numNodes,
        simulationDuration=optSimulationDuration,
        networkFilePath=optAvroraNetworkFile)

    getLedTimes(avroraOutputFile, numNodes)
    getLedStates(avroraOutputFile, numNodes)
    Energy.getEnergy(outputPath)
    copyFiles(queryDir, measurementsActiveAgendaLoops)
예제 #5
0
def evaluateAvroraQueryPlan(nescDir, query, outputPath, numNodes, duration,
                            schemaPath, aqRate, avroraNetFile, energyGraph):

    #Compile the nesC
    exitVal = AvroraLib.compileNesCCode(nescDir)
    if (exitVal != 0):
        return
    AvroraLib.generateODs(nescDir)

    for i in range(0, optNumAvroraRuns):
        if optNumAvroraRuns > 1:
            report("Avrora simulation run #%d for candidate %s\n" %
                   (i, outputPath))

        #run avrora simulation
        (avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(
            nescDir,
            outputPath + '/' + query + '/avrora',
            query,
            numNodes,
            simulationDuration=duration,
            networkFilePath=avroraNetFile)

        #check all tuples present
        #TODO: We can't do this for now because MQE branch doesn't produce query plan/candidate summary
        #queryPlanSummaryFile = "%s/%s/query-plan/query-plan-summary.txt" % (outputPath, query)
        #actualBFactor = SneeqlLib.getBufferingFactor(queryPlanSummaryFile)
        #checkTupleCount.checkResults(query, traceFilePath, schemaPath, aqRate, actualBFactor, duration)

        #Report total energy consumption
        siteLifetimeRankFile = "%s/site-lifetime-rank.csv" % nescDir
        (sumEnergy, maxEnergy, averageEnergy, radioEnergy, cpu_cycleEnergy,
         sensorEnergy, otherEnergy,
         networkLifetime) = AvroraLib.computeEnergyValues(
             nescDir,
             duration,
             inputFile="avrora-out.txt",
             ignoreLedEnergy=True,
             siteLifetimeRankFile=siteLifetimeRankFile)
        report("The total energy consumption is %f" % (sumEnergy))
        report("The lifetime for this network is %f" % (networkLifetime))

        #candidateInfo = getCandidateSummaryInformation(nescDir, query, outputPath)
        #print candidateInfo

        energyGraph.addPoint("Sensor", query, str(sensorEnergy))
        energyGraph.addPoint("CPU", query, str(cpu_cycleEnergy))
        energyGraph.addPoint("Radio", query, str(radioEnergy))
        energyGraph.addPoint("Other", query, str(otherEnergy))
예제 #6
0
def doTest():
    mainPath = optOutputRoot + "/" + optMeasurementDir + "/"

    if SneeqlLib.optQuery != None:
        SneeqlLib.compileQuery("AvroraSim",
                               targets="Avrora1",
                               outputRootDir=mainPath)
        queryParts = SneeqlLib.optQuery.split("/")
        query = queryParts[len(queryParts) - 1]
        codePath = mainPath + "/" + query + "/avrora1/"
    else:
        copyInput(mainPath)
        codePath = mainPath + "/avrora1/"
    #Use this to get many durations in one run.
    #multiplyNCFiles(codePath, range(0, 1))

    report("codePath = " + codePath)

    exitVal = AvroraLib.compileNesCCode(codePath)
    if (exitVal != 0):
        return
    AvroraLib.generateODs(codePath)
    print "complied"

    numNodes = getMaxMote(codePath)
    desc = "test"

    #Multiple loops of same code
    openSummarises()
    for i in range(0, 2):
        outputDir = mainPath + "/run" + str(i)
        if not os.path.isdir(outputDir):
            os.makedirs(outputDir)

        #run avrora simulation
        (avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(
            codePath,
            outputDir,
            desc,
            numNodes,
            simulationDuration=optSimulationDuration,
            networkFilePath=optAvroraNetworkFile)

        getLedTimes(avroraOutputFile, numNodes)
        getLedStates(avroraOutputFile, numNodes)
        Energy.getEnergy(outputDir)
        copyFiles(outputDir, i)
    closeFiles()
예제 #7
0
def testAvroraCandidate(nescDir, query, outputPath, numNodes, duration,
                        schemaPath, aqRate, avroraNetFile, rtscore_lifetime):

    #Compile the nesC
    exitVal = AvroraLib.compileNesCCode(nescDir)
    if (exitVal != 0):
        return
    AvroraLib.generateODs(nescDir)

    for i in range(0, optNumAvroraRuns):
        if optNumAvroraRuns > 1:
            report("Avrora simulation run #%d for candidate %s\n" %
                   (i, outputPath))

        #run avrora simulation
        (avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(
            nescDir,
            outputPath,
            query,
            numNodes,
            simulationDuration=duration,
            networkFilePath=avroraNetFile)

        #check all tuples present
        queryPlanSummaryFile = "%s/%s/query-plan/query-plan-summary.txt" % (
            outputPath, query)
        actualBFactor = SneeqlLib.getBufferingFactor(queryPlanSummaryFile)
        checkTupleCount.checkResults(query, traceFilePath, schemaPath, aqRate,
                                     actualBFactor, duration)

        #Report total energy consumption
        siteLifetimeRankFile = "%s/site-lifetime-rank.csv" % nescDir
        (sumEnergy, maxEnergy, averageEnergy, radioEnergy, cpu_cycleEnergy,
         sensorEnergy, otherEnergy,
         networkLifetime) = AvroraLib.computeEnergyValues(
             nescDir,
             duration,
             inputFile="avrora-out.txt",
             ignoreLedEnergy=True,
             siteLifetimeRankFile=siteLifetimeRankFile)
        report("The total energy consumption is %f" % (sumEnergy))
        report("The lifetime for this network is %f" % (networkLifetime))

        (agendaName, rtName, score) = getRTScore(nescDir, query, outputPath)
        agendaID = agendaName.split("-")[2]
        rtscore_lifetime.add(1, sumEnergy, agendaID)
예제 #8
0
def testAvroraCandidate(nescDir, query, outputPath, numNodes, duration, schemaPath, aqRate, avroraNetFile):

	#Compile the nesC
	exitVal = AvroraLib.compileNesCCode(nescDir)
	if (exitVal != 0):
		return;		
	AvroraLib.generateODs(nescDir)

	for i in range(0, optNumAvroraRuns):
		if optNumAvroraRuns > 1:
			report("Avrora simulation run #%d for candidate %s\n" % (i, outputPath))
	
		#run avrora simulation
		(avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(nescDir, outputPath, query, numNodes, simulationDuration = duration, networkFilePath = avroraNetFile)

		#check all tuples present
		queryPlanSummaryFile = "%s/%s/query-plan/query-plan-summary.txt" % (outputPath, query)
		actualBFactor = SneeqlLib.getBufferingFactor(queryPlanSummaryFile)
		checkTupleCount.checkResults(query, traceFilePath, schemaPath, aqRate, actualBFactor, duration)	
예제 #9
0
def testAvroraCandidate(nescDir, query, outputPath, numNodes, duration, schemaPath, aqRate, avroraNetFile, alphaGraph, deltaGraph, epsilonGraph, lambdaGraph):

	#Compile the nesC
	exitVal = AvroraLib.compileNesCCode(nescDir)
	if (exitVal != 0):
		return;		
	AvroraLib.generateODs(nescDir)

	candidateInfo = getCandidateSummaryInformation(nescDir, query, outputPath)
	candidateInfo['total-energy'] = []
	candidateInfo['network-lifetime'] = []
	alpha = int(candidateInfo['alpha-ms'])
	bufferingFactor = int(candidateInfo['beta'])
	duration = int((float(optNumAgendaEvals) * float(alpha) * float(bufferingFactor)) / 1000.0)
	
	for i in range(0, optNumAvroraRuns):
		if optNumAvroraRuns > 1:
			report("Avrora simulation run #%d for candidate %s\n" % (i, outputPath))
	
		#run avrora simulation
		(avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(nescDir, outputPath, query, numNodes, simulationDuration = duration, networkFilePath = avroraNetFile)

		#check all tuples present
		queryPlanSummaryFile = "%s/%s/query-plan/query-plan-summary.txt" % (outputPath, query)
		checkTupleCount.checkResults(query, traceFilePath, schemaPath, alpha, bufferingFactor, duration)	

		#Report total energy consumption
		siteLifetimeRankFile = "%s/site-lifetime-rank.csv" % nescDir
		(sumEnergy, maxEnergy, averageEnergy, radioEnergy, cpu_cycleEnergy, sensorEnergy, otherEnergy, networkLifetime) = AvroraLib.computeEnergyValues(nescDir, duration, inputFile = "avrora-out.txt", ignoreLedEnergy = True, siteLifetimeRankFile = siteLifetimeRankFile)

		lifetimeDays = UtilLib.secondsToDays(networkLifetime) #Put this into avrora lib so rank file has it too
		
		report ("The total energy consumption is %f" % (sumEnergy))
		normSumEnergy = (float(sumEnergy) / float(duration)) * float(optQueryDuration) #to do: use new function (below)
		report ("The normalized total energy consumption is %f" % (normSumEnergy))
		report ("The lifetime for this network is %f" % (lifetimeDays))

		candidateInfo['total-energy'].append(float(normSumEnergy))
		candidateInfo['network-lifetime'].append(float(lifetimeDays))

	print "DEBUG: testAvroraCandidate.candidateInfo = " + str(candidateInfo)
	return candidateInfo
예제 #10
0
def runSimulation(nescDir):

    #run avrora simulation
    (avroraOutputFile,
     traceFilePath) = AvroraLib.runSimulation(nescDir, nescDir, 'sim',
                                              optNumNodes, optSimDuration,
                                              optTopFile)

    #Report total energy consumption
    siteLifetimeRankFile = "%s/site-lifetime-rank.csv" % nescDir
    (sumEnergy, maxEnergy, averageEnergy, radioEnergy, cpu_cycleEnergy,
     sensorEnergy, otherEnergy,
     networkLifetime) = AvroraLib.computeEnergyValues(
         nescDir,
         optSimDuration,
         inputFile="avrora-out.txt",
         ignoreLedEnergy=True,
         siteLifetimeRankFile=siteLifetimeRankFile)

    report("The total energy consumption is %f" % (sumEnergy))
    report("The lifetime for this network is %f" % (networkLifetime))
예제 #11
0
def mainLoop():
    queryFile = queryMap[optQuery]
    networkFile = networkMap[optNetworkSize]
    heteroNet = (optNetworkType == 'B')
    schemaFile = numSourcesMap[optNetworkSize + '_' + optNumSources]
    qosFile = optGoalMap[optOptGoal]
    overallOutputDir = optOutputRoot + '/' + optQuery + '-' + optNetworkSize + 'n-type' + optNetworkType + '-' + optNumSources + 's-' + optOptGoal

    duration = 100
    #	for nn in range(optMinNN,optMaxNN+1):
    for nn in [0, 1, 3, 5, 10, 15, 20]:
        runOutputDir = overallOutputDir + '/nn' + str(nn)

        invokeQueryOptimizer(runOutputDir, queryFile, networkFile, heteroNet,
                             schemaFile, qosFile, nn)
        summary = parseOutFile(runOutputDir + '/' + optQuery +
                               '/query-plan/matlab/wheresched/out' + str(nn) +
                               '.txt')

        if optOptGoal == 'min_delivery':
            #check all tuples present
            queryPlanSummaryFile = "%s/%s/query-plan/query-plan-summary.txt" % (
                runOutputDir, optQuery)

            deliveryTime = SneeqlLib.getDeliveryTime(queryPlanSummaryFile)
            logToDataFile(overallOutputDir, nn, summary['min_f'],
                          float(deliveryTime), summary['num DAFs considered'])
        else:
            #Compile the nesC
            nescDir = runOutputDir + '/' + optQuery + '/avrora1'
            exitVal = AvroraLib.compileNesCCode(nescDir)
            if (exitVal != 0):
                reportError("Error compiling avrora nesC code")
                return
            AvroraLib.generateODs(nescDir)

            #Invoke Avrora simulation
            avroraNetFile = UtilLib.winpath(
                os.getenv('SNEEQLROOT')) + '\\\\' + networkFile.replace(
                    '.xml', '.top')
            (avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(
                nescDir,
                runOutputDir,
                optQuery,
                int(optNetworkSize),
                simulationDuration=duration,
                networkFilePath=avroraNetFile)

            #Check query results
            schemaPath = os.getenv('SNEEQLROOT') + '/' + schemaFile
            checkTupleCount.checkResults(optQuery, traceFilePath, schemaPath,
                                         10000, 1, duration)

            #Report total energy consumption
            siteLifetimeRankFile = "%s/site-lifetime-rank.csv" % nescDir
            (sumEnergy, maxEnergy, averageEnergy, radioEnergy, cpu_cycleEnergy,
             sensorEnergy, otherEnergy,
             networkLifetime) = AvroraLib.computeEnergyValues(
                 runOutputDir,
                 duration,
                 inputFile="avrora-out.txt",
                 ignoreLedEnergy=True,
                 siteLifetimeRankFile=siteLifetimeRankFile)
            report("The total energy consumption is %f" % (sumEnergy))
            report("The lifetime for this network is %f" %
                   (networkLifetime))  #seems to be in seconds

            if optOptGoal == 'min_energy':
                logToDataFile(overallOutputDir, nn, summary['min_f'],
                              float(sumEnergy), summary['num DAFs considered'])
            else:
                logToDataFile(overallOutputDir, nn, summary['min_f'],
                              float(networkLifetime),
                              summary['num DAFs considered'])
예제 #12
0
def testAvroraCandidate(nescDir, query, outputPath, numNodes, duration,
                        schemaPath, aqRate, avroraNetFile, alphaGraph,
                        deltaGraph, epsilonGraph, lambdaGraph):

    #Compile the nesC
    exitVal = AvroraLib.compileNesCCode(nescDir)
    if (exitVal != 0):
        return
    AvroraLib.generateODs(nescDir)

    for i in range(0, optNumAvroraRuns):
        if optNumAvroraRuns > 1:
            report("Avrora simulation run #%d for candidate %s\n" %
                   (i, outputPath))

        #run avrora simulation
        (avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(
            nescDir,
            outputPath,
            query,
            numNodes,
            simulationDuration=duration,
            networkFilePath=avroraNetFile)

        #check all tuples present
        queryPlanSummaryFile = "%s/%s/query-plan/query-plan-summary.txt" % (
            outputPath, query)
        actualBFactor = SneeqlLib.getBufferingFactor(queryPlanSummaryFile)
        checkTupleCount.checkResults(query, traceFilePath, schemaPath, aqRate,
                                     actualBFactor, duration)

        #Report total energy consumption
        siteLifetimeRankFile = "%s/site-lifetime-rank.csv" % nescDir
        (sumEnergy, maxEnergy, averageEnergy, radioEnergy, cpu_cycleEnergy,
         sensorEnergy, otherEnergy,
         networkLifetime) = AvroraLib.computeEnergyValues(
             nescDir,
             duration,
             inputFile="avrora-out.txt",
             ignoreLedEnergy=True,
             siteLifetimeRankFile=siteLifetimeRankFile)
        report("The total energy consumption is %f" % (sumEnergy))
        report("The lifetime for this network is %f" % (networkLifetime))

        candidateInfo = getCandidateSummaryInformation(nescDir, query,
                                                       outputPath)
        print candidateInfo

        rtID = candidateInfo['rt-id'].split("-")[2]
        #TODO: Cross-candidate comparison: plot acquisition interval score vs min possible acq interval
        alphaGraph.add(float(candidateInfo['rt-alpha-score']),
                       float(candidateInfo['pi-ms']) / 1000.0, rtID)
        #TODO: Cross-candidate comparison: plot delivery time score vs simulated total energy
        deltaGraph.add(float(candidateInfo['rt-delta-score']),
                       float(candidateInfo['delta-ms']) / 1000.0, rtID)
        #TODO: Cross-candidate comparison: plot total energy score vs simulated total energy
        epsilonGraph.add(float(candidateInfo['rt-epsilon-score']),
                         float(sumEnergy), rtID)
        #TODO: Cross-candidate comparison: plot lifetime score vs simulated lifetime
        lambdaGraph.add(float(candidateInfo['rt-lambda-score']),
                        UtilLib.secondsToDays(networkLifetime), rtID)
예제 #13
0
def doTest(measurementsRemoveOperators):
    mainPath = optOutputRoot + "/" + SneeqlLib.optQuery + "/" + measurementsRemoveOperators + "/"
    if SneeqlLib.optQuery != None:
        SneeqlLib.compileQuery(
            "AvroraSim",
            targets="Avrora1",
            outputRootDir=mainPath,
            measurementsRemoveOperators=measurementsRemoveOperators)
        queryParts = SneeqlLib.optQuery.split("/")
        query = queryParts[len(queryParts) - 1]
        codePath = mainPath + "/" + query + "/avrora1/"
    else:
        copyInput(mainPath)
        codePath = mainPath + "/avrora1/"
    #Use this to get many durations in one run.
    #multiplyNCFiles(codePath, range(0, 1))

    report("codePath = " + codePath)

    exitVal = AvroraLib.compileNesCCode(codePath)
    if (exitVal != 0):
        return
    AvroraLib.generateODs(codePath)
    print "complied"

    numNodes = getMaxMote(codePath)
    desc = "test"

    #Multiple loops of same code
    openSummarises(mainPath)
    if optSimulationDurationList != None:
        queryEnergyFile.write(measurementsRemoveOperators + ",")
        queryYellowFile.write(measurementsRemoveOperators + ",")
        queryYellowMinFile.write(measurementsRemoveOperators + ",")
        queryGreenFile.write(measurementsRemoveOperators + ",")
        queryRedFile.write(measurementsRemoveOperators + ",")
        querySizeFile.write(measurementsRemoveOperators + "," +
                            str(AvroraLib.ram) + "," + str(AvroraLib.rom) +
                            "\n")
        for i in range(0, len(optSimulationDurationList)):
            outputDir = mainPath + "/duration" + str(
                optSimulationDurationList[i])
            if not os.path.isdir(outputDir):
                os.makedirs(outputDir)

            #run avrora simulation
            (avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(
                codePath,
                outputDir,
                desc,
                numNodes,
                simulationDuration=optSimulationDurationList[i],
                networkFilePath=optAvroraNetworkFile)

            getLedTimes(avroraOutputFile, numNodes)
            getLedStates(avroraOutputFile, numNodes)
            Energy.getEnergy(outputDir)
            copyFiles(outputDir, i, "dur" + str(optSimulationDurationList[i]))
        queryEnergyFile.write("\n")
        queryRedFile.write("\n")
        queryYellowFile.write("\n")
        queryYellowMinFile.write("\n")
        queryGreenFile.write("\n")
    else:
        for i in range(0, 1):
            outputDir = mainPath + "/run" + str(i)
            if not os.path.isdir(outputDir):
                os.makedirs(outputDir)

            #run avrora simulation
            (avroraOutputFile, traceFilePath) = AvroraLib.runSimulation(
                codePath,
                outputDir,
                desc,
                numNodes,
                simulationDuration=optSimulationDuration,
                networkFilePath=optAvroraNetworkFile)

            getLedTimes(avroraOutputFile, numNodes)
            getLedStates(avroraOutputFile, numNodes)
            Energy.getEnergy(outputDir)
            copyFiles(outputDir, i, "Run " + str(i))
    closeFiles()