Below is the code and error. Please help me.
#include "ns3/test.h"
#include <ns3/log.h>
#include <ns3/nstime.h>
#include <ns3/callback.h>
#include <ns3/config.h>
#include <ns3/boolean.h>
#include <ns3/simulator.h>
#include <ns3/node-container.h>
#include <ns3/net-device-container.h>
#include <ns3/ipv4-interface-container.h>
#include <ns3/lte-helper.h>
#include <ns3/point-to-point-epc-helper.h>
#include <ns3/internet-stack-helper.h>
#include <ns3/point-to-point-helper.h>
#include <ns3/ipv4-address-helper.h>
#include <ns3/ipv4-static-routing-helper.h>
#include <ns3/mobility-helper.h>
#include <ns3/data-rate.h>
#include <ns3/ipv4-static-routing.h>
#include <ns3/position-allocator.h>
using namespace ns3;
NS_LOG_COMPONENT_DEFINE("LteHandoverDelayTest");
class LteHandoverDelayTestCase : public TestCase
{
public:
LteHandoverDelayTestCase (uint8_t numberOfComponentCarriers, bool useIdealRrc, Time handoverTime,
Time delayThreshold, Time simulationDuration)
: TestCase ("Verifying that the time needed for handover is under a specified threshold"),
m_numberOfComponentCarriers (numberOfComponentCarriers),
m_useIdealRrc (useIdealRrc),
m_handoverTime (handoverTime),
m_delayThreshold (delayThreshold),
m_simulationDuration (simulationDuration),
m_ueHandoverStart (Seconds (0)),
m_enbHandoverStart (Seconds (0))
{
}
private:
virtual void DoRun (void);
void UeHandoverStartCallback (std::string context, uint64_t imsi,
uint16_t cellid, uint16_t rnti, uint16_t targetCellId);
void UeHandoverEndOkCallback (std::string context, uint64_t imsi,
uint16_t cellid, uint16_t rnti);
void EnbHandoverStartCallback (std::string context, uint64_t imsi,
uint16_t cellid, uint16_t rnti, uint16_t targetCellId);
void EnbHandoverEndOkCallback (std::string context, uint64_t imsi,
uint16_t cellid, uint16_t rnti);
uint8_t m_numberOfComponentCarriers;
bool m_useIdealRrc;
Time m_handoverTime;
Time m_delayThreshold;
Time m_simulationDuration;
Time m_ueHandoverStart;
Time m_enbHandoverStart;
};
void
LteHandoverDelayTestCase::DoRun ()
{
NS_LOG_INFO ("-----test case: ideal RRC = " << m_useIdealRrc
<< " handover time = " << m_handoverTime.GetSeconds () << "-----");
/*
* Helpers.
*/
auto epcHelper = CreateObject<PointToPointEpcHelper> ();
auto lteHelper = CreateObject<LteHelper> ();
lteHelper->SetEpcHelper (epcHelper);
lteHelper->SetAttribute ("UseIdealRrc", BooleanValue (m_useIdealRrc));
lteHelper->SetAttribute ("NumberOfComponentCarriers", UintegerValue (m_numberOfComponentCarriers));
auto ccHelper = CreateObject<CcHelper> ();
ccHelper->SetUlEarfcn (100 + 18000);
ccHelper->SetDlEarfcn (100);
ccHelper->SetUlBandwidth (25);
ccHelper->SetDlBandwidth (25);
ccHelper->SetNumberOfComponentCarriers (m_numberOfComponentCarriers);
/*
* Physical layer.
*
* eNodeB 0 UE eNodeB 1
*
* x ----------------------- x ----------------------- x
* 500 m 500 m
*/
// Create nodes.
NodeContainer enbNodes;
enbNodes.Create (2);
auto ueNode = CreateObject<Node> ();
// Setup mobility
auto posAlloc = CreateObject<ListPositionAllocator> ();
posAlloc->Add (Vector (0, 0, 0));
posAlloc->Add (Vector (1000, 0, 0));
posAlloc->Add (Vector (500, 0, 0));
MobilityHelper mobilityHelper;
mobilityHelper.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobilityHelper.SetPositionAllocator (posAlloc);
mobilityHelper.Install (enbNodes);
mobilityHelper.Install (ueNode);
/*
* Link layer.
*/
auto enbDevs = lteHelper->InstallEnbDevice (enbNodes);
auto ueDev = lteHelper->InstallUeDevice (ueNode).Get (0);
/*
* Network layer.
*/
InternetStackHelper inetStackHelper;
inetStackHelper.Install (ueNode);
Ipv4InterfaceContainer ueIfs;
ueIfs = epcHelper->AssignUeIpv4Address (ueDev);
// Setup traces.
Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/HandoverStart",
MakeCallback (&LteHandoverDelayTestCase::UeHandoverStartCallback, this));
Config::Connect ("/NodeList/*/DeviceList/*/LteUeRrc/HandoverEndOk",
MakeCallback (&LteHandoverDelayTestCase::UeHandoverEndOkCallback, this));
Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/HandoverStart",
MakeCallback (&LteHandoverDelayTestCase::EnbHandoverStartCallback, this));
Config::Connect ("/NodeList/*/DeviceList/*/LteEnbRrc/HandoverEndOk",
MakeCallback (&LteHandoverDelayTestCase::EnbHandoverEndOkCallback, this));
// Prepare handover.
lteHelper->AddX2Interface (enbNodes);
lteHelper->Attach (ueDev, enbDevs.Get(0));
lteHelper->HandoverRequest (m_handoverTime, ueDev, enbDevs.Get (0), enbDevs.Get (1));
// Run simulation.
Simulator::Stop (m_simulationDuration);
Simulator::Run ();
Simulator::Destroy ();
} // end of void LteHandoverDelayTestCase::DoRun ()
void
LteHandoverDelayTestCase::UeHandoverStartCallback (std::string context,
uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
{
NS_LOG_FUNCTION (this << context);
m_ueHandoverStart = Simulator::Now ();
}
void
LteHandoverDelayTestCase::UeHandoverEndOkCallback (std::string context,
uint64_t imsi, uint16_t cellid, uint16_t rnti)
{
NS_LOG_FUNCTION (this << context);
NS_ASSERT (m_ueHandoverStart > Seconds (0));
Time delay = Simulator::Now () - m_ueHandoverStart;
NS_LOG_DEBUG (this << " UE delay = " << delay.GetSeconds ());
NS_TEST_ASSERT_MSG_LT (delay.GetSeconds (), m_delayThreshold.GetSeconds (),
"UE handover delay is higher than the allowed threshold "
<< "(ideal RRC = " << m_useIdealRrc
<< " handover time = " << m_handoverTime.GetSeconds () << ")");
}
void
LteHandoverDelayTestCase::EnbHandoverStartCallback (std::string context,
uint64_t imsi, uint16_t cellid, uint16_t rnti, uint16_t targetCellId)
{
NS_LOG_FUNCTION (this << context);
m_enbHandoverStart = Simulator::Now ();
}
void
LteHandoverDelayTestCase::EnbHandoverEndOkCallback (std::string context,
uint64_t imsi, uint16_t cellid, uint16_t rnti)
{
NS_LOG_FUNCTION (this << context);
NS_ASSERT (m_enbHandoverStart > Seconds (0));
Time delay = Simulator::Now () - m_enbHandoverStart;
NS_LOG_DEBUG (this << " eNodeB delay = " << delay.GetSeconds ());
NS_TEST_ASSERT_MSG_LT (delay.GetSeconds (), m_delayThreshold.GetSeconds (),
"eNodeB handover delay is higher than the allowed threshold "
<< "(ideal RRC = " << m_useIdealRrc
<< " handover time = " << m_handoverTime.GetSeconds () << ")");
}
static class LteHandoverDelayTestSuite : public TestSuite
{
public:
LteHandoverDelayTestSuite ()
: TestSuite ("lte-handover-delay", TestSuite::SYSTEM)
{
//LogComponentEnable ("LteHandoverDelayTest", LOG_PREFIX_TIME);
//LogComponentEnable ("LteHandoverDelayTest", LOG_DEBUG);
//LogComponentEnable ("LteHandoverDelayTest", LOG_INFO);
// HANDOVER DELAY TEST CASES WITH IDEAL RRC (THRESHOLD = 0.005 sec)
for (Time handoverTime = Seconds (0.100); handoverTime < Seconds (0.110);
handoverTime += Seconds (0.001))
{
// arguments: useIdealRrc, handoverTime, delayThreshold, simulationDuration
AddTestCase (
new LteHandoverDelayTestCase (1, true, handoverTime, Seconds (0.005),
Seconds (0.200)), TestCase::QUICK);
}
// HANDOVER DELAY TEST CASES WITH REAL RRC (THRESHOLD = 0.020 sec)
for (Time handoverTime = Seconds (0.100); handoverTime < Seconds (0.110);
handoverTime += Seconds (0.001))
{
// arguments: useIdealRrc, handoverTime, delayThreshold, simulationDuration
AddTestCase (
new LteHandoverDelayTestCase (1, false, handoverTime, Seconds (0.020),
Seconds (0.200)), TestCase::QUICK);
}
}
} g_lteHandoverDelayTestSuite;
[1758/1906] Compiling scratch/handover-delay.cc
../scratch/handover-delay.cc: In member function ‘virtual void LteHandoverDelayTestCase::DoRun()’:
../scratch/handover-delay.cc:98:6: error: ‘auto’ changes meaning in C++11; please remove it [-Werror=c++0x-compat]
auto epcHelper = CreateObject<PointToPointEpcHelper> ();
^
../scratch/handover-delay.cc:98:11: error: ‘epcHelper’ does not name a type
auto epcHelper = CreateObject<PointToPointEpcHelper> ();
^
../scratch/handover-delay.cc:100:6: error: ‘auto’ changes meaning in C++11; please remove it [-Werror=c++0x-compat]
auto lteHelper = CreateObject<LteHelper> ();
^
../scratch/handover-delay.cc:100:11: error: ‘lteHelper’ does not name a type
auto lteHelper = CreateObject<LteHelper> ();
^
../scratch/handover-delay.cc:101:6: error: ‘lteHelper’ was not declared in this scope
lteHelper->SetEpcHelper (epcHelper);
^
../scratch/handover-delay.cc:101:31: error: ‘epcHelper’ was not declared in this scope
lteHelper->SetEpcHelper (epcHelper);
^
../scratch/handover-delay.cc:105:6: error: ‘auto’ changes meaning in C++11; please remove it [-Werror=c++0x-compat]
auto ccHelper = CreateObject<CcHelper> ();
^
../scratch/handover-delay.cc:105:11: error: ‘ccHelper’ does not name a type
auto ccHelper = CreateObject<CcHelper> ();
^
../scratch/handover-delay.cc:106:6: error: ‘ccHelper’ was not declared in this scope
ccHelper->SetUlEarfcn (100 + 18000);
^
../scratch/handover-delay.cc:123:6: error: ‘auto’ changes meaning in C++11; please remove it [-Werror=c++0x-compat]
auto ueNode = CreateObject<Node> ();
^
../scratch/handover-delay.cc:123:11: error: ‘ueNode’ does not name a type
auto ueNode = CreateObject<Node> ();
^
../scratch/handover-delay.cc:126:6: error: ‘auto’ changes meaning in C++11; please remove it [-Werror=c++0x-compat]
auto posAlloc = CreateObject<ListPositionAllocator> ();
^
../scratch/handover-delay.cc:126:11: error: ‘posAlloc’ does not name a type
auto posAlloc = CreateObject<ListPositionAllocator> ();
^
../scratch/handover-delay.cc:127:6: error: ‘posAlloc’ was not declared in this scope
posAlloc->Add (Vector (0, 0, 0));
^
../scratch/handover-delay.cc:135:30: error: ‘ueNode’ was not declared in this scope
mobilityHelper.Install (ueNode);
^
../scratch/handover-delay.cc:140:6: error: ‘auto’ changes meaning in C++11; please remove it [-Werror=c++0x-compat]
auto enbDevs = lteHelper->InstallEnbDevice (enbNodes);
^
../scratch/handover-delay.cc:140:11: error: ‘enbDevs’ does not name a type
auto enbDevs = lteHelper->InstallEnbDevice (enbNodes);
^
../scratch/handover-delay.cc:141:6: error: ‘auto’ changes meaning in C++11; please remove it [-Werror=c++0x-compat]
auto ueDev = lteHelper->InstallUeDevice (ueNode).Get (0);
^
../scratch/handover-delay.cc:141:11: error: ‘ueDev’ does not name a type
auto ueDev = lteHelper->InstallUeDevice (ueNode).Get (0);
^
../scratch/handover-delay.cc:149:46: error: ‘ueDev’ was not declared in this scope
ueIfs = epcHelper->AssignUeIpv4Address (ueDev);
^
../scratch/handover-delay.cc:164:32: error: ‘enbDevs’ was not declared in this scope
lteHelper->Attach (ueDev, enbDevs.Get(0));
^
cc1plus: all warnings being treated as errors
Waf: Leaving directory `/home/topside/ns3/ns-allinone-3.25/ns-3.25/build'