NS3中PointToPoint如何设置信道的抖动和丢包率?
How to set jitter and loss rate of channel while using PointToPoint in NS3?
我是 NS3 的新手,通过它的教程学习 NS3。在教程示例first.cc中,展示了如何使用PointToPointHelper
和UdpEchoClientHelper
进行P2P测试,我们可以找到如何设置Data Rate
和Delay
渠道。但是我想设置通道的抖动和丢包率,请问有什么方法吗?
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
....
信道丢失率
好消息是the tutorial已经涵盖了这个
ns-3 provides ErrorModel objects which can be attached to Channels. We are using the RateErrorModel which allows us to introduce errors into a Channel at a given rate.
Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ();
em->SetAttribute ("ErrorRate", DoubleValue (0.00001));
devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
The above code instantiates a RateErrorModel Object, and we set the “ErrorRate” Attribute to the desired value. We then set the resulting instantiated RateErrorModel as the error model used by the point-to-point NetDevice. This will give us some retransmissions and make our plot a little more interesting.
抖动
抖动是数据包遇到的处理和排队延迟的函数。这不是您直接设置的数量。相反,它是根据连接生命周期内所有数据包的延迟测量值计算得出的。抖动的典型定义是连接生命周期内所有数据包延迟的标准偏差。
所以,ns-3 没有提供直接设置抖动的方法(虽然它可以,因为它是一个模拟器,但我离题了)。
但还是有希望的:如果你想改变抖动,你需要改变处理和排队延迟。处理延迟有点不确定,但可以通过在 NetDevice 上选择队列类型轻松更改排队延迟。参考PointToPointNetDevice的TxQueue
属性。
我是 NS3 的新手,通过它的教程学习 NS3。在教程示例first.cc中,展示了如何使用PointToPointHelper
和UdpEchoClientHelper
进行P2P测试,我们可以找到如何设置Data Rate
和Delay
渠道。但是我想设置通道的抖动和丢包率,请问有什么方法吗?
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
....
信道丢失率
好消息是the tutorial已经涵盖了这个
ns-3 provides ErrorModel objects which can be attached to Channels. We are using the RateErrorModel which allows us to introduce errors into a Channel at a given rate.
Ptr<RateErrorModel> em = CreateObject<RateErrorModel> (); em->SetAttribute ("ErrorRate", DoubleValue (0.00001)); devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
The above code instantiates a RateErrorModel Object, and we set the “ErrorRate” Attribute to the desired value. We then set the resulting instantiated RateErrorModel as the error model used by the point-to-point NetDevice. This will give us some retransmissions and make our plot a little more interesting.
抖动
抖动是数据包遇到的处理和排队延迟的函数。这不是您直接设置的数量。相反,它是根据连接生命周期内所有数据包的延迟测量值计算得出的。抖动的典型定义是连接生命周期内所有数据包延迟的标准偏差。
所以,ns-3 没有提供直接设置抖动的方法(虽然它可以,因为它是一个模拟器,但我离题了)。
但还是有希望的:如果你想改变抖动,你需要改变处理和排队延迟。处理延迟有点不确定,但可以通过在 NetDevice 上选择队列类型轻松更改排队延迟。参考PointToPointNetDevice的TxQueue
属性。