当前位置: 首页>>代码示例>>Python>>正文


Python Network.getReceivedPackets方法代码示例

本文整理汇总了Python中Network.Network.getReceivedPackets方法的典型用法代码示例。如果您正苦于以下问题:Python Network.getReceivedPackets方法的具体用法?Python Network.getReceivedPackets怎么用?Python Network.getReceivedPackets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Network.Network的用法示例。


在下文中一共展示了Network.getReceivedPackets方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: transmitData

# 需要导入模块: from Network import Network [as 别名]
# 或者: from Network.Network import getReceivedPackets [as 别名]
def transmitData(inputFile, logDir, predictionInterval, samplingInterval, 
                 heartbeat, drThreshold, delay, jitter, packetLoss):
	# Import data
	print "Importing data..."
	importer = Importer()
	rawInputData = importer.getInputData(inputFile, samplingInterval)
	exportData(logDir + "RawInputData.txt", rawInputData)
	
	# Filtering input data
	print "Filtering data..."
	samplingFreq = int(1e3/samplingInterval)
	taps = 80
	bands = [0.0, 10, 11, 50.0]
	weights = [1, 0]
	coefficients = scipy.signal.remez(taps, bands, weights, Hz=samplingFreq)
	gain = 1.0 / sum(coefficients)
	filteredInputData = filterData(rawInputData, logDir, "cc", samplingInterval, coefficients)[0]
	filteredInputData = amplifyData(filteredInputData, gain)
	exportData(logDir + "FilteredInputData.txt", filteredInputData)

	# Create the prediction vectors
	print "Creating the prediction vectors..."
	predictor = DRPredictor()
	predictedData = predictor.getPredictedData(filteredInputData, predictionInterval, samplingInterval)
	exportData(logDir + "PredictionData.txt", predictedData)

	# Run the transmission algorithm
	print "Simulating the transmission algorithm..."
	transmitter = DRTransmitter(heartbeat)
	drTxPackets = transmitter.getTransmittedPackets(drThreshold, predictedData)
	exportData(logDir + "DRTxPackets.txt", drTxPackets)

	# Simulate the transmission of the packets
	print "Simulating the network..."
	network = Network()
	drRxPackets = network.getReceivedPackets(drTxPackets, delay, jitter, packetLoss)
	exportData(logDir + "DRRxPackets.txt", drRxPackets)

	# Receive the packets
	print "Receiving the packets..."
	receiver = Receiver()
	drRxFilteredPackets = receiver.getFilteredData(drRxPackets)
	exportData(logDir + "DRRxData.txt", drRxFilteredPackets)

	return [rawInputData, filteredInputData, predictedData, drTxPackets, 
	        drRxPackets, drRxFilteredPackets]
开发者ID:fstakem,项目名称:Pecan,代码行数:48,代码来源:Simulator.py

示例2: DRPredictor

# 需要导入模块: from Network import Network [as 别名]
# 或者: from Network.Network import getReceivedPackets [as 别名]
inputData = importer.getInputData(inputFile, samplingInterval)

# Create the prediction vectors
print "Creating the prediction vectors..."
predictor = DRPredictor()
predictedData = predictor.getPredictedData(inputData, predictionInterval, samplingInterval)

# Run the transmission algorithm
print "Simulating the transmission algorithm..."
transmitter = DRTransmitter(heartbeat)
DRTxPackets = transmitter.getTransmittedPackets(threshold, predictedData)

# Simulate the transmission of the packets
print "Simulating the network..."
network = Network()
DRRxPackets = network.getReceivedPackets(DRTxPackets, delay, jitter, packetLoss)

# Receive the packets
print "Receiving the packets..."
receiver = Receiver()
DRRxData = receiver.getFilteredData(DRRxPackets)

# Reconstruct the transmitted and received data
print "Reconstructing the signals..."
reconstructor = SnapReconstructor()
DRTxData = reconstructor.getReconstructedSignal(DRTxPackets, samplingInterval)
DRRxReconData = reconstructor.getReconstructedSignal(DRRxData, samplingInterval)

# Split data into components
inputTime = range(0, len(inputData) * samplingInterval, samplingInterval)
x = []
开发者ID:fstakem,项目名称:Pecan,代码行数:33,代码来源:FftReceivedMovement.py

示例3: len

# 需要导入模块: from Network import Network [as 别名]
# 或者: from Network.Network import getReceivedPackets [as 别名]
jitterEstimate = [ networkParams[1] ] * len(predictedData)
ADRTxPackets = transmitter.getTransmittedPackets(minThreshold, maxThreshold, maxDelay, \
                                                 maxJitter, delayEstimate, jitterEstimate,\
                                                 predictedData)
outputData("ADRTransmittedPackets", ADRTxPackets)

# Reconstructed transmitted data
reconstructor = SnapReconstructor()
DRTxData = reconstructor.getReconstructedSignal(DRTxPackets, samplingInterval)
outputData("DRTransmittedData", DRTxData)
ADRTxData = reconstructor.getReconstructedSignal(ADRTxPackets, samplingInterval)
outputData("ADRTransmittedData", ADRTxData)

# Simulate network
network = Network()
DRRxPackets = network.getReceivedPackets(DRTxPackets, networkParams[0], networkParams[1], \
									     networkParams[2])
outputData("DRReceivedPackets", DRRxPackets)
ADRRxPackets = network.getReceivedPackets(ADRTxPackets, networkParams[0], networkParams[1], \
									      networkParams[2])
outputData("ADRReceivedPackets", ADRRxPackets)

# Received data
receiver = Receiver()
DRRxData = receiver.getFilteredData(DRRxPackets)
outputData("DRReceivedData", DRRxData)
ADRRxData = receiver.getFilteredData(ADRRxPackets)
outputData("ADRReceivedData", ADRRxData)

# Reconstructed received data
DRRxReconData = reconstructor.getReconstructedSignal(DRRxData, samplingInterval)
outputData("DRRxReconData", DRRxReconData)
开发者ID:fstakem,项目名称:AdaptiveGameNet,代码行数:34,代码来源:CreateFinalResults.py


注:本文中的Network.Network.getReceivedPackets方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。