标签:
lteHelper->AddX2Interface (enbNodes);
NS_LOG=EpcX2:LteEnbRrc ./waf --run lena-x2-handover --command="%s --ns3::LteEnbRrc::AdmitHandoverRequest=false"
lteHelper->HandoverRequest (Seconds (0.100), ueLteDevs.Get (0), enbLteDevs.Get (0), enbLteDevs.Get (1));
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> (); lteHelper->SetHandoverAlgorithmType ("ns3::A2A4RsrqHandoverAlgorithm");
lteHelper->SetHandoverAlgorithmAttribute ("ServingCellThreshold", UintegerValue (30)); lteHelper->SetHandoverAlgorithmAttribute ("NeighbourCellOffset", UintegerValue (1));
lteHelper->SetHandoverAlgorithmType ("ns3::A3RsrpHandoverAlgorithm"); lteHelper->SetHandoverAlgorithmAttribute ("Hysteresis", DoubleValue (3.0)); lteHelper->SetHandoverAlgorithmAttribute ("TimeToTrigger", TimeValue (MilliSeconds (256)));
lteHelper->SetHandoverAlgorithmType ("ns3::NoOpHandoverAlgorithm");
NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (false)); Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (false));
通过使用上述代码,我们同时在控制和数据信道以及上行和下行方向上禁用误差模型。这是必要的,因为切换相关的信令消息通过使用这些信道来传输。例外是当仿真使用理想的 RRC 协议时,这种情况下,只需考虑随机接入过程。该过程包含控制消息,因此,我们只需要禁用控制信道的误差模型。
void NotifyHandoverStartUe (std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, uint16_t targetCellId) { std::cout << Simulator::Now ().GetSeconds () << " " << context << " UE IMSI " << imsi << ": previously connected to CellId " << cellId << " with RNTI " << rnti << ", doing handover to CellId " << targetCellId << std::endl; } void NotifyHandoverEndOkUe (std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti) { std::cout << Simulator::Now ().GetSeconds () << " " << context << " UE IMSI " << imsi << ": successful handover to CellId " << cellId << " with RNTI " << rnti << std::endl; } void NotifyHandoverStartEnb (std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti, uint16_t targetCellId) { std::cout << Simulator::Now ().GetSeconds () << " " << context << " eNB CellId " << cellId << ": start handover of UE with IMSI " << imsi << " RNTI " << rnti << " to CellId " << targetCellId << std::endl; } void NotifyHandoverEndOkEnb (std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti) { std::cout << Simulator::Now ().GetSeconds () << " " << context << " eNB CellId " << cellId << ": completed handover of UE with IMSI " << imsi << " RNTI " << rnti << std::endl; }
Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/HandoverStart", MakeCallback (&NotifyHandoverStartEnb)); Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/HandoverStart", MakeCallback (&NotifyHandoverStartUe)); Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/HandoverEndOk", MakeCallback (&NotifyHandoverEndOkEnb)); Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/HandoverEndOk", MakeCallback (&NotifyHandoverEndOkUe));
./waf --run lena-x2-handover
NS_LOG=LteEnbRrc:LteUeRrc:EpcX2 ./waf --run lena-x2-handover
参考文献
LTE Module User Documentation(翻译12)——X2切换(X2-based handover)
标签:
原文地址:http://www.cnblogs.com/alice123/p/5505733.html