25 #include <ns3/nstime.h> 
   26 #include <ns3/callback.h> 
   27 #include <ns3/config.h> 
   28 #include <ns3/boolean.h> 
   29 #include <ns3/double.h> 
   30 #include <ns3/uinteger.h> 
   31 #include <ns3/simulator.h> 
   33 #include <ns3/node-container.h> 
   34 #include <ns3/net-device-container.h> 
   35 #include <ns3/ipv4-interface-container.h> 
   37 #include <ns3/lte-helper.h> 
   38 #include <ns3/point-to-point-epc-helper.h> 
   39 #include <ns3/internet-stack-helper.h> 
   40 #include <ns3/point-to-point-helper.h> 
   41 #include <ns3/ipv4-address-helper.h> 
   42 #include <ns3/ipv4-static-routing-helper.h> 
   43 #include <ns3/mobility-helper.h> 
   45 #include <ns3/data-rate.h> 
   46 #include <ns3/ipv4-static-routing.h> 
   47 #include <ns3/position-allocator.h> 
   48 #include <ns3/lte-enb-net-device.h> 
   49 #include <ns3/lte-enb-phy.h> 
   88                              uint8_t gridSizeX, uint8_t gridSizeY,
 
   89                              uint16_t sourceCellId, uint16_t targetCellId,
 
   90                              std::string handoverAlgorithmType);
 
  101   void HandoverStartCallback (std::string context, uint64_t imsi,
 
  102                               uint16_t sourceCellId, uint16_t rnti,
 
  103                               uint16_t targetCellId);
 
  109   void CellShutdownCallback ();
 
  116   virtual void DoRun ();
 
  122   virtual void DoTeardown ();
 
  139                                                       uint8_t gridSizeX, uint8_t gridSizeY,
 
  140                                                       uint16_t sourceCellId, uint16_t targetCellId,
 
  141                                                       std::string handoverAlgorithmType)
 
  143     m_uePosition (uePosition),
 
  144     m_gridSizeX (gridSizeX),
 
  145     m_gridSizeY (gridSizeY),
 
  146     m_sourceCellId (sourceCellId),
 
  147     m_targetCellId (targetCellId),
 
  148     m_handoverAlgorithmType (handoverAlgorithmType),
 
  150     m_hasHandoverOccurred (false)
 
  156   uint16_t nEnb = gridSizeX * gridSizeY;
 
  158   if (sourceCellId > nEnb)
 
  163   if (targetCellId > nEnb)
 
  178                                                   uint16_t sourceCellId, uint16_t rnti,
 
  179                                                   uint16_t targetCellId)
 
  181   NS_LOG_FUNCTION (
this << context << imsi << sourceCellId << rnti << targetCellId);
 
  185                          "Handover occured but too early");
 
  187                          "Handover occured but with wrong source cell");
 
  189                          "Handover occured but with wrong target cell");
 
  223                            StringValue (
"ns3::FriisSpectrumPropagationLossModel"));
 
  279   enbMobility.
Install (enbNodes);
 
  290   Ptr<Node> pgw = epcHelper->GetPgwNode ();
 
  294   remoteHostContainer.
Create (1);
 
  297   internet.
Install (remoteHostContainer);
 
  306   ipv4h.
SetBase (
"1.0.0.0", 
"255.0.0.0");
 
  326   for (uint32_t u = 0; u < ueNodes.
GetN (); ++u)
 
  331       ueStaticRouting->
SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
 
  349   lteHelper->
Attach (ueDevs.
Get (0), sourceEnb);
 
  352   Simulator::Schedule (
Seconds (0.5),
 
  358   Simulator::Destroy ();
 
  388   : 
TestSuite (
"lte-handover-target", SYSTEM)
 
  404                                               Vector (20, 40, 0), 2, 2, 1, 3,
 
  405                                               "ns3::A2A4RsrqHandoverAlgorithm"),
 
  408                                               Vector (20, 40, 0), 2, 2, 1, 3,
 
  409                                               "ns3::A3RsrpHandoverAlgorithm"),
 
  419                                               Vector (150, 90, 0), 3, 2, 5, 2,
 
  420                                               "ns3::A2A4RsrqHandoverAlgorithm"),
 
  421                TestCase::EXTENSIVE);
 
  423                                               Vector (150, 90, 0), 3, 2, 5, 2,
 
  424                                               "ns3::A3RsrpHandoverAlgorithm"),
 
  425                TestCase::EXTENSIVE);
 
Testing a handover algorithm, verifying that it selects the right target cell when more than one opti...
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
AttributeValue implementation for Boolean. 
 
NetDeviceContainer InstallEnbDevice(NodeContainer c)
Create a set of eNodeB devices. 
 
holds a vector of std::pair of Ptr and interface index. 
 
uint16_t GetCellId() const 
 
void SetDefaultRoute(Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a default route to the static routing table. 
 
Ptr< T > GetObject(void) const 
Get a pointer to the requested aggregated Object. 
 
Hold variables of type string. 
 
Ptr< NetDevice > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
 
NetDeviceContainer Install(NodeContainer c)
 
a class to represent an Ipv4 address mask 
 
Ptr< LteEnbPhy > GetPhy(void) const 
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
 
void Attach(NetDeviceContainer ueDevices)
Enables automatic attachment of a set of UE devices to a suitable cell using Idle mode initial cell s...
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit. 
 
aggregate IP/TCP/UDP functionality to existing Nodes. 
 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO. 
 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
 
Build a set of PointToPointNetDevice objects. 
 
std::string m_handoverAlgorithmType
 
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper. 
 
void SetHandoverAlgorithmType(std::string type)
Set the type of handover algorithm to be used by eNodeB devices. 
 
uint32_t GetN(void) const 
Get the number of Ptr stored in this container. 
 
Class for representing data rates. 
 
void CellShutdownCallback()
A trigger that can be scheduled to "shutdown" the cell pointed by m_sourceCellId by reducing its powe...
 
void Install(Ptr< Node > node) const 
"Layout" a single node according to the current position allocator type. 
 
void SetHandoverAlgorithmAttribute(std::string n, const AttributeValue &v)
Set an attribute for the handover algorithm to be created. 
 
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite. 
 
AttributeValue implementation for Time. 
 
Hold an unsigned integer type. 
 
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not. 
 
holds a vector of ns3::NetDevice pointers 
 
void HandoverStartCallback(std::string context, uint64_t imsi, uint16_t sourceCellId, uint16_t rnti, uint16_t targetCellId)
Triggers when an eNodeB starts a handover and then verifies that the handover has the right source an...
 
static LteHandoverTargetTestSuite g_lteHandoverTargetTestSuiteInstance
 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
 
virtual void DoRun()
Run a simulation of a micro-cell network using the parameters provided to the constructor function...
 
void Connect(std::string path, const CallbackBase &cb)
 
Access to the Ipv4 forwarding table, interfaces, and configuration. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
keep track of a set of node pointers. 
 
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
 
virtual void DoTeardown()
Called at the end of simulation and verifies that a handover has occurred in the simulation. 
 
void SetTxPower(double pow)
 
void Install(std::string nodeName) const 
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
 
void AddX2Interface(NodeContainer enbNodes)
Create an X2 interface between all the eNBs in a given set. 
 
Test suite lte-handover-target, verifying that handover algorithms are able to select the right targe...
 
Ptr< LteEnbNetDevice > m_sourceEnbDev
 
bool m_hasHandoverOccurred
 
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper. 
 
LteHandoverTargetTestCase(std::string name, Vector uePosition, uint8_t gridSizeX, uint8_t gridSizeY, uint16_t sourceCellId, uint16_t targetCellId, std::string handoverAlgorithmType)
Construct a new test case and providing input parameters for the simulation. 
 
NetDeviceContainer InstallUeDevice(NodeContainer c)
Create a set of UE devices. 
 
Helper class used to assign positions and mobility models to nodes. 
 
void AddNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface, uint32_t metric=0)
Add a network route to the static routing table. 
 
Ipv4 addresses are stored in host order in this class. 
 
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
 
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const 
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
 
void SetEpcHelper(Ptr< EpcHelper > h)
Set the EpcHelper to be used to setup the EPC network in conjunction with the setup of the LTE radio ...
 
Helper class that adds ns3::Ipv4StaticRouting objects. 
 
AttributeValue implementation for DataRate. 
 
Ptr< Node > Get(uint32_t i) const 
Get the Ptr stored in this container at a given index. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
void SetDefault(std::string name, const AttributeValue &value)
 
void Add(Vector v)
Add a position to the list of positions. 
 
LteHandoverTargetTestSuite()
 
std::string GetName(void) const 
 
A helper class to make life easier while doing simple IPv4 address assignment in scripts. 
 
Time Now(void)
create an ns3::Time instance which contains the current simulation time. 
 
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer. 
 
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
 
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not. 
 
This class can be used to hold variables of floating point type such as 'double' or 'float'...
 
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful. 
 
The eNodeB device implementation. 
 
virtual ~LteHandoverTargetTestCase()
 
int64_t GetMilliSeconds(void) const 
Get an approximation of the time stored in this instance in the indicated unit. 
 
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.