示例#1
0
# ------
# Set the packet length (in bytes) of the source
source.setPDUSize(100)  # 100 bytes payload

# LINK
# ----
# Set the data rate of the link interfaces (in bits/s)
dataRate = 1e6
h1.eth0.phy.setDataRate(dataRate)
h2.eth0.phy.setDataRate(dataRate)

# Set the propagation delay of the link.
# The link is 1000 km long and we cannot easily change this.
# But we can adapt the signal speed to obtain the required propagation delay.
propDelay = 0.01  # in seconds
link.signalSpeed = 1000000.0 / propDelay

# Set the error model of the link
# Use the bernoulli error model with the required Bit Error Rate.
# A BER of 0.0 gives an error free link, of course.
BER = 0.0001
link.errorModel('bernoulli', BER)

# ARQ STRATEGIES (Data link layer)
# -------------------------------
# Set the retransmission timeout
timeout = 0.021
h1.eth0.dl.retransmissionTimeout = timeout
h2.eth0.dl.retransmissionTimeout = timeout

# Set the sliding window size (Only for GoBackNDL, and SelectiveRepeatDL)