0
如何使用ns3中的屬性設置值?我有一個文件中定義的類的屬性,我嘗試在我的主函數中設置。我無法改變它們。如何使用ns3中的屬性
我的問題:
這是定義:
TypeId MpTcpSocketBase::GetTypeId(void)
{
static TypeId tid = TypeId("ns3::MpTcpSocketBase")
.SetParent<TcpSocketBase>()
.AddConstructor<MpTcpSocketBase>()
.AddAttribute("CongestionControl",
"Congestion control algorithm",
EnumValue(Linked_Increases),
MakeEnumAccessor(&MpTcpSocketBase::SetCongestionCtrlAlgo),
MakeEnumChecker(Uncoupled_TCPs, "Uncoupled_TCPs",
Fully_Coupled, "Fully_Coupled",
RTT_Compensator, "RTT_Compensator",
Linked_Increases, "Linked_Increases",
COUPLED_INC, "COUPLED_INC",
COUPLED_EPSILON, "COUPLED_EPSILON",
COUPLED_SCALABLE_TCP, "COUPLED_SCALABLE_TCP",
COUPLED_FULLY, "COUPLED_FULLY",
UNCOUPLED, "UNCOUPLED"))
.AddAttribute("SchedulingAlgorithm",
"Algorithm for data distribution between sub-flows",
EnumValue(Round_Robin),
MakeEnumAccessor(&MpTcpSocketBase::SetDataDistribAlgo),
MakeEnumChecker(Round_Robin, "Round_Robin"))
.AddAttribute("PathManagement",
"Mechanism for establishing new sub-flows",
EnumValue(FullMesh),
MakeEnumAccessor(&MpTcpSocketBase::SetPathManager),
MakeEnumChecker(Default,"Default",
FullMesh, "FullMesh",
NdiffPorts, "NdiffPorts"))
.AddAttribute("MaxSubflows",
"Maximum number of sub-flows per each mptcp connection",
UintegerValue(8),
MakeUintegerAccessor(&MpTcpSocketBase::maxSubflows),
MakeUintegerChecker<uint8_t>())
.AddAttribute("RandomGap",
"Random gap between subflows setup",
UintegerValue(50),
MakeUintegerAccessor(&MpTcpSocketBase::m_rGap),
MakeUintegerChecker<uint32_t>())
.AddAttribute("Subflows",
"The list of sub-flows associated to this protocol.",
ObjectVectorValue(),
MakeObjectVectorAccessor(&MpTcpSocketBase::subflows),
MakeObjectVectorChecker<MpTcpSocketBase>())
.AddAttribute ("ShortFlowTCP", "Use TCP for short flows",
BooleanValue (false),
MakeBooleanAccessor (&MpTcpSocketBase::m_shortFlowTCP),
MakeBooleanChecker())
.AddAttribute ("AlphaPerAck", " Update alpha per ACK ",
BooleanValue (false),
MakeBooleanAccessor (&MpTcpSocketBase::m_alphaPerAck),
MakeBooleanChecker())
.AddAttribute ("ShortPlotting", " Activate large flow plotting ",
BooleanValue (false),
MakeBooleanAccessor (&MpTcpSocketBase::m_shortPlotting),
MakeBooleanChecker())
.AddAttribute ("LargePlotting", " Activate short flow plotting ",
BooleanValue (false),
MakeBooleanAccessor (&MpTcpSocketBase::m_largePlotting),
MakeBooleanChecker());
return tid;
}
這是利用:
Config::SetDefault("ns3::Ipv4GlobalRouting::FlowEcmpRouting", BooleanValue(true));
Config::SetDefault("ns3::TcpSocket::SegmentSize", UintegerValue(1400));
Config::SetDefault("ns3::TcpSocket::DelAckCount", UintegerValue(0));
Config::SetDefault("ns3::DropTailQueue::Mode", StringValue("QUEUE_MODE_PACKETS"));
Config::SetDefault("ns3::DropTailQueue::MaxPackets", UintegerValue(100));
Config::SetDefault("ns3::TcpL4Protocol::SocketType", TypeIdValue(MpTcpSocketBase::GetTypeId()));
Config::SetDefault("ns3::MpTcpSocketBase::MaxSubflows", UintegerValue(8)); // Sink
Config::SetDefault("ns3::MpTcpSocketBase::CongestionControl", StringValue("Uncoupled_TCPs"));
//Config::SetDefault("ns3::MpTcpSocketBase::PathManagement", StringValue("NdiffPorts"));
但沒有什麼是已經發生了變化,有沒有什麼辦法可以設置這個值在我的主要功能。
解釋是的我知道了,謝謝。 – ferrer