ns3-configure different congestion control algorithms

 本篇解决的问题,怎么在ns3的仿真实验中,给不同的socket配置不同的拥塞控制算法。
 Someone may want to compare the throughput of different congestion control algorithms in ns3 as what I do with ns2[1]. But the command to configure socket type globally may not saturate such need.

Config::SetDefault("ns3::TcpL4Protocol::SocketType", StringValue("ns3::TcpReno"));

  There is another way to get such problem solved.

SetCongestionControlAlgorithm (algo);

 Of cource, other congestion control algorithms can add here:

void TcpClient::SetCongestionAlgo(std::string &algo){
    m_algo=algo;
}
void TcpClient::ConfigureCongstionAlgo(){
    TypeId id;
    if(0==m_algo.compare("reno")){  
        id=TcpNewReno::GetTypeId ();  
    }else if(0==m_algo.compare("linux-reno")){  
        id=TcpLinuxReno::GetTypeId();  
    }else if(0==m_algo.compare("vegas")){  
        id=TcpVegas::GetTypeId ();  
    }else if(0==m_algo.compare("bic")){  
        id=TcpBic::GetTypeId ();  
    }else if(0==m_algo.compare("cubic")){   
        id=TcpCubic::GetTypeId();   
    }else if (0==m_algo.compare ("westwood")){ 
        id=TcpWestwood::GetTypeId ();  
    }else{   
        id=TcpLinuxReno::GetTypeId();   
    }   
    ObjectFactory congestionAlgorithmFactory;   
    congestionAlgorithmFactory.SetTypeId (id);  
    Ptr<TcpCongestionOps> algo = congestionAlgorithmFactory.Create<TcpCongestionOps> ();   
    TcpSocketBase *base=static_cast<TcpSocketBase*>(PeekPointer(m_socket));  
    base->SetCongestionControlAlgorithm (algo);  
}

  For other algorithms, just add the specific id:

id=TcpHighSpeed::GetTypeId ();
id=TcpHtcp::GetTypeId();
id=TcpHybla::GetTypeId();
id=TcpIllinois::GetTypeId();
id=TcpLedbat::GetTypeId();
id=TcpLp::GetTypeId();
id=TcpVeno::GetTypeId();
id=TcpYeah::GetTypeId();

 And the code can be downloaded at [2].
During the simulation, the values on rtt, congestion window, inflight packet, rate from sender and rate from receiver are logged out.
Some results are given here:
cwnd.png
在这里插入图片描述
inflight.png
在这里插入图片描述
rtt.png
在这里插入图片描述
sendrate.png
在这里插入图片描述
goodput.png
在这里插入图片描述

[1] ns2仿真学习(三)-不同tcp拥塞控制的竞争能力
[2] congetion algorithms configuration

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值