def snapReconstructData(packetData, logDir, fileEnding, samplingInterval): # Snap reconstruct the transmitted and received data #print "Snap reconstructing the signals..." snapReconstructor = SnapReconstructor() snapData = snapReconstructor.getReconstructedSignal(packetData, samplingInterval) exportData(logDir + "SnapData_" + fileEnding + ".txt", snapData) return [snapData]
def snapReconstructData(packetData, logDir, fileEnding, samplingInterval): # Snap reconstruct the transmitted and received data #print "Snap reconstructing the signals..." snapReconstructor = SnapReconstructor() snapData = snapReconstructor.getReconstructedSignal( packetData, samplingInterval) exportData(logDir + "SnapData_" + fileEnding + ".txt", snapData) return [snapData]
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 = [] y = [] z = [] transmittedTime = [] txX = [] txY = [] txZ = [] receivedTime = [] rxX = [] rxY = []
# 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() DRRxData = receiver.getFilteredData(DRRxPackets) exportData(logDir + "DRRxData.txt", DRRxData) # Snap reconstruct the transmitted and received data print "Snap reconstructing the signals..." snapReconstructor = SnapReconstructor() DRTxSnapData = snapReconstructor.getReconstructedSignal(DRTxPackets, samplingInterval) DRRxSnapData = snapReconstructor.getReconstructedSignal(DRRxData, samplingInterval) exportData(logDir + "DRTxSnapData.txt", DRTxSnapData) exportData(logDir + "DRRxSnapData.txt", DRRxSnapData) # Interpolation reconstruct the transmitted and received data print "Interpolation reconstructing the signals..." intReconstructor = IntReconstructor() DRTxIntData = intReconstructor.getReconstructedSignal(DRTxPackets, samplingInterval, interpolationType, reconThreshold) DRRxIntData = intReconstructor.getReconstructedSignal(DRRxData, samplingInterval, interpolationType, reconThreshold) exportData(logDir + "DRTxIntData.txt", DRTxIntData) exportData(logDir + "DRRxIntData.txt", DRRxIntData)