getting the position of neighboring LTE eNodeB

862 views
Skip to first unread message

KH Chua

unread,
Mar 5, 2014, 4:53:02 AM3/5/14
to ns-3-...@googlegroups.com
Hi

I like to do some modification so that each eNodeB can have a record of the positions all other eNodeBs in the present in the simulation simulation.

Can anyone advise on how can I get the position of other eNodeB in the codes?

Thanks

Konstantinos

unread,
Mar 5, 2014, 5:29:34 AM3/5/14
to ns-3-...@googlegroups.com
Since the positions of the eNBs are fixed throughout the simulation, you only need to add it as a member variable in the class that you need this information (e.g. the eNB MAC?).

For example you can create a member variable  std::map<enb_id, position> that will hold the id and position of each enb, and at the start of the simulation you can initialize this variable for each enb. 

KH Chua

unread,
Mar 5, 2014, 8:15:23 AM3/5/14
to ns-3-...@googlegroups.com
Thanks for the reply. I have the same thoughts. But I trying to figure out how to mapping the eNB ID to the correct Position for that eNB.

In a standard script to run LTE simulation, we have the following lines of codes to set the position of eNBs:

  // Install Mobility Model in eNB
  Ptr<ListPositionAllocator> enbPositionAlloc = CreateObject<ListPositionAllocator> ();
  for (uint16_t i = 0; i < numberOfEnbs; i++)
    {
      Vector enbPosition (distance * (i + 1), distance, 30);
      enbPositionAlloc->Add (enbPosition);
    }
  MobilityHelper enbMobility;
  enbMobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
  enbMobility.SetPositionAllocator (enbPositionAlloc);
  enbMobility.Install (enbNodes);

To install eNB device to a node created, we have the following lines of codes:

 // Install LTE Devices in eNB and UEs
  NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
  NetDeviceContainer ueLteDevs = lteHelper->InstallUeDevice (ueNodes);

Referring to the following function in position-allocator.cc we can get the position we set for the eNB:

void
ListPositionAllocator::Add (Vector v)
{
  m_positions.push_back (v);
  m_current = m_positions.begin ();
}

And, referring to the following function in lte-helper.cc we can get the cellID for the eNB created:

Ptr<NetDevice>
LteHelper::InstallSingleEnbDevice (Ptr<Node> n)
{
  NS_ABORT_MSG_IF (m_cellIdCounter == 65535, "max num eNBs exceeded");
  uint16_t cellId = ++m_cellIdCounter;

  Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
  Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
  .
  .
  .
}

Then, how do we map the CellID to its respective location?

Konstantinos

unread,
Mar 5, 2014, 8:50:37 AM3/5/14
to ns-3-...@googlegroups.com
You can get the CellId from the LteEnbNetDevice::GetCellId() and the position from the MobilityModel::GetPosition()
Both classes (LteEnbNetDevice and MobilityModel) can be accessed having the knowledge of the node.

KH Chua

unread,
Mar 5, 2014, 9:10:14 AM3/5/14
to ns-3-...@googlegroups.com
Thanks. I will try it out.

KH Chua

unread,
Mar 6, 2014, 4:22:02 AM3/6/14
to ns-3-...@googlegroups.com
When we have created the member variable such as the std::map<enb_id, position>, if I want add a timer to each record in the map container such that when timer for record1 expires then record1 will be removed, similarly when timer for record2 expires then record2 to will be removed, do you have suggestion on how we can associate a timer to each of the record?

Thanks

Konstantinos

unread,
Mar 6, 2014, 5:56:59 AM3/6/14
to ns-3-...@googlegroups.com
You can implement a timer in a similar way that for example OLSR is using in AssociationTupleTimerExpire, DupTupleTimerExpire etc. It has a local variable to store Tuples (entries) and when a timer expires this particular entry is deleted. 

KH Chua

unread,
Mar 8, 2014, 7:34:36 AM3/8/14
to ns-3-...@googlegroups.com
What I know is that, using the std::map<> function, usually we can only map two parameters at a time.

If I want to map 3 - 4 parameters at a time. Can we still use the std::map function? 


On Wednesday, March 5, 2014 6:29:34 PM UTC+8, Konstantinos wrote:

Konstantinos

unread,
Mar 8, 2014, 9:56:13 AM3/8/14
to ns-3-...@googlegroups.com
First of all, std::map is not a function.
Second, you are right, each map has 1 key and 1 element. However, the element can be a struct or a class or any type, so you can define your own type with more than 1 values.

KH Chua

unread,
Mar 24, 2014, 3:56:58 AM3/24/14
to ns-3-...@googlegroups.com
Dear Konstantinos,

I not sure how or where to use the LteEnbNetDevice::GetCellId() and MobilityModel::GetPosition() functions. Can you give an example?

The modification I like to achieve is that when the UE moves away and exceeded a certain distance from its source eNB, it will send a Handover Preparation to the nearest neighbor eNB. For that, I would need the UE to know which eNB it is currently attached. Can the GetCellId() be used on the UE?

Thanks

Konstantinos

unread,
Mar 24, 2014, 4:33:07 AM3/24/14
to ns-3-...@googlegroups.com


On Monday, March 24, 2014 7:56:58 AM UTC, KH Chua wrote:
Dear Konstantinos,

I not sure how or where to use the LteEnbNetDevice::GetCellId() and MobilityModel::GetPosition() functions. Can you give an example?


You need to have a pointer to the  LteEnbNetDevice and call the GetCellId(). If you look at the API, perhaps the UE knows at which eNB is attached to.
For the position you need to have a pointer to the node eg.

Ptr<Node> node;
Ptr<MobilityModel> mob = node->GetObject<MobilityMode>();
Vector pos = mob->GetPosition();


 
The modification I like to achieve is that when the UE moves away and exceeded a certain distance from its source eNB, it will send a Handover Preparation to the nearest neighbor eNB. For that, I would need the UE to know which eNB it is currently attached. Can the GetCellId() be used on the UE?


Have you looked at the other 'automatic' handover mechanisms? There are algorithms with 'strongest cell', not closest.

KH Chua

unread,
Mar 24, 2014, 5:38:39 AM3/24/14
to ns-3-...@googlegroups.com
Thanks. I will try it out.

Yea, I have reviewed the automatic' handover mechanisms and the 'strongest cell' handover algorithm before this. I will go through them again, perhaps I can modify from there.

KH Chua

unread,
Mar 24, 2014, 7:51:55 AM3/24/14
to ns-3-...@googlegroups.com
After checking the API, I think they do have a function that allows us to get the eNB the UE is attached to.

And following your example, I was able to map the cellId with the enb position using std::map.

I done it in the lte-helper.cc and lte-helper.h files. I need to use this mapped information at another file. Usually we can just "include" it in the header of the file we need to use it.

But the lte-helper.h file is located in another folder.

How can I include it if it is in another folder?

KH Chua

unread,
Mar 24, 2014, 8:05:40 AM3/24/14
to ns-3-...@googlegroups.com
Instead of using just #include "lte-helper.h",I used #include "ns3/lte-helper.h"

So, it is working already.

Thanks

KH Chua

unread,
Mar 24, 2014, 9:39:31 AM3/24/14
to ns-3-...@googlegroups.com
After getting the positions of UE and source eNB (the eNB that the UE is attached),Ilike to calculate the distance between them.

I thought of using the function "double ns3::CalculateDistance (const Vector2D &a, const Vector2D &b)" to calculate the distance.

But the positions of UE and eNB returned by the function GetPosition( ) are of type "Vector" while the arguments accepted by the CalculateDistance function are of type "Vector2D".

Are "Vector" and "Vector2D" compatible?

Thanks


On Monday, March 24, 2014 4:33:07 PM UTC+8, Konstantinos wrote:

Konstantinos

unread,
Mar 24, 2014, 9:56:00 AM3/24/14
to ns-3-...@googlegroups.com
Hi,

The CalcualteDistance() can use both Vector2D and Vector==Vector3D attributes. 

FYI Vector2D has only (x,y) and Vector == Vector3D has (x, y, z)

KH Chua

unread,
Mar 24, 2014, 8:39:24 PM3/24/14
to ns-3-...@googlegroups.com
Hi

I like set it such that my simulation will periodically calculate the distance between the UE and its source eNB at a fixed time interval, from the time the simulation starts.

So, I thought of creating a class that perform such function, and call it repeatedly at a fixed interval.

Can you suggest how can I do that?

Konstantinos

unread,
Mar 24, 2014, 8:46:57 PM3/24/14
to ns-3-...@googlegroups.com
Simulator::Schedule or a Timer is what you are looking for. 
I do not think that you need to create a new class for the calculation of distance. You may need a class in general that will be the new handover algorithm.

KH Chua

unread,
Mar 24, 2014, 9:07:41 PM3/24/14
to ns-3-...@googlegroups.com
Thanks.

For the calculation of distance, I got consider implementing it as a function in an existing class.

Using Simulator::Schedule, I can trigger the function periodically. But Simulator::Schedule would only works once that function has been triggered at least a time, then it can call that function repeatedly after the first trigger.

But one more thing that I not sure, how do I make that first trigger?

KH Chua

unread,
Mar 24, 2014, 9:33:31 PM3/24/14
to ns-3-...@googlegroups.com
I also need a way to get the RNTI of a UE. From the API, I found this function 
uint16_t ns3::LteUeRrc::GetRnti(void)const
at http://www.nsnam.org/docs/doxygen/classns3_1_1_lte_ue_rrc.html#a5d7fad482ff68a116c0bab7433c816ec

Can this function be used with knowledge of the Ptr<LteUeNetDevice> ?
Reply all
Reply to author
Forward
0 new messages