LENA: Remove and reattach an UE during the simulation

686 views
Skip to first unread message

Michele Polese

unread,
Jul 21, 2015, 1:05:52 PM7/21/15
to ns-3-...@googlegroups.com
Hi everybody,
I am trying to dynamically disconnect and reconnect UEs during a simulation, I read all the thread I found in this mailing list and it seems to be a non trivial operation.
Inspired by this thread I wrote a deAttach function (which I can schedule during the simulation)

void
deAttach(Ptr<NetDevice> ueDev, Ptr<NetDevice> enbDev) {
  // note: only 1 eNB in this scenario
  Ptr<LteUeNetDevice> ueLteDevice = ueDev->GetObject<LteUeNetDevice> ();
  Ptr<LteEnbNetDevice> enbDevice = enbDev->GetObject<LteEnbNetDevice>();
  // get some info
  uint16_t rnti = ueLteDevice->GetRrc()->GetRnti();
  uint16_t cellId = ueLteDevice->GetRrc()->GetCellId();
  NS_LOG_INFO("The UE rnti is " << rnti << " and the cellId is " << cellId);
  uint16_t enb_cellId = enbDevice->GetCellId();
  NS_LOG_INFO("The ENB cellId is " << enb_cellId);

  // remove the user from the eNB
  Ptr<LteEnbRrc> enbRrc = enbDevice->GetRrc();
  Ptr<LteEnbMac> enbMac = enbDevice->GetMac();
  enbMac-> GetLteEnbCmacSapProvider ()-> ReleaseLc( rnti, 1 );
  enbRrc->RemoveUe( rnti );

  // reconfigure UE rrc
  Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc(); // optimize this call
  ueRrc->GetAsSapProvider()->Disconnect(); // now in IDLE_CAMPED_NORMALLY
}

and a reAttach function which acts only on the UE:

void
reAttach(Ptr<LteHelper> lteHelper, Ptr<NetDevice> ueDev) {
  Ptr<LteUeRrc> ueRrc = ueDev->GetObject<LteUeNetDevice> ()->GetRrc();
  ueRrc->GetAsSapProvider()->Connect();
}


On top of the UE I have an application which sends periodically some data to the socket, even when the UE is not connected to the network. The detach event is scheduled at 10 s and the attach event at 20 s.
I attach MAC and PDCP traces. In the MAC trace it can be seen that no packets are exchanged in the interval [10, 20] s, and that transmission resumes after 20 s with a new rnti. However, in the PDCP trace there is just the first transmission.

I don't know if this is the right approach and what I am missing something since I am quite new to LENA. Does anybody have an idea of what is going on? I can provide the complete code if needed.
Thank you very much!
UlPdcpStats.txt
UlMacStats.txt

hongyu deng

unread,
Mar 24, 2016, 9:39:54 AM3/24/16
to ns-3-users
Hi Michele,
Do you solve this problem?
Are those code write in app layer or Lte-Enb-Rrc.cc or other source file?
I write in lena-x2-handover-measure.cc,but it can't work?
I update Enb's parameters through updateconfigure() in Lte-Enb-Netdevice.cc,
And the UE need to update to achieve tx data. So i need to remove ue from enb and later reconnect to enb?
Does you code work normal in your computer?

Best, 
Hongyu.

Michele Polese

unread,
Mar 28, 2016, 4:24:02 AM3/28/16
to ns-3-users
Hi Hongyu,
unfortunately the focus of my study shifted and I did not address that problem anymore.
Those snippets of code must be placed in the main simulation script, and I think that the issue with the missing Pdcp stats is linked to how the helpers and the stats calculator classes work, try to take a look at them. 
Michele

hongyu deng

unread,
Mar 28, 2016, 7:51:00 AM3/28/16
to ns-3-users
Hi Michele,

Thanks for your reply and advice.
The code can work now,i can use the code  like this in main simulator script.

Simulator::Schedule (Seconds (5.0), &deAttach, ueLteDevs.Get(0),enbLteDevs.Get(0));
Simulator::Schedule (Seconds (10.1), &reAttach, ueLteDevs.Get(0));

But do you found that after reAttach to ENB ,the data can not TX from UE to ENB ,the UE can only RX from remoteHost? 
Do you found that thing?What does it happen?Do you know why?

Best, 
Hongyu.

Michele Polese

unread,
Mar 28, 2016, 8:34:29 AM3/28/16
to ns-3-users
I observed that data are not recorded in the Pdcp stats after reconnection. Notice that this is just a hack, it is not a sound way to perform connection/disconnection since it doesn't follow protocol rules but just calls a bunch of methods from the LTE module stack which are not designed to perform such a thing. 
Michele

hongyu deng

unread,
Mar 28, 2016, 9:06:27 AM3/28/16
to ns-3-users
Hi Michele,
Do you know Where is the problem happens now? And how to disconnect/reconnect UE from ENB in a normally way?

Or do you have some advices to fix this problem?

Havefun,
Hongyu.

Michele Polese

unread,
Mar 28, 2016, 9:10:06 AM3/28/16
to ns-3-users

Hi Hongyu,
I did not investigated on the issue further. However the current LTE module supports only RRC connected state (and the ones to reach it), in order to correctly model disconnection an IDLE state should be added (as well as other things as paging for example).
Michele


--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/nvbQBGUa0x8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

hongyu deng

unread,
Mar 28, 2016, 10:03:32 AM3/28/16
to ns-3-users
Hi Michele,
Thanks your advice,i need to do this thing and find out where is the problem happens.
I need to read the source code and change it to achieve data TX and RX normally after reconnect.(If it can be achieved)

Havefun,
Hongyu.

Dariush Soleymani

unread,
Jun 4, 2016, 5:37:52 AM6/4/16
to ns-3-users
Hello Dear Hongyu,
I need also to detach ue from enb for while and re-attach. would be possible to share the code.
Regards,
Dariush

در دوشنبه 28 مارس 2016، ساعت 16:03:32 (UTC+2)، hongyu deng نوشته:

hongyu deng

unread,
Jun 4, 2016, 8:24:34 AM6/4/16
to ns-3-users
Hi Dariush,

You can do like this in simulation script,but it no a normal way even though it can work:

void deAttach(Ptr<NetDevice> ueDev, Ptr<NetDevice> enbDev)
{
  // note: only 1 eNB in this scenario
  Ptr<LteUeNetDevice> ueLteDevice = ueDev->GetObject<LteUeNetDevice> ();
  Ptr<LteEnbNetDevice> enbDevice = enbDev->GetObject<LteEnbNetDevice>();
  // get some info
  uint16_t rnti = ueLteDevice->GetRrc()->GetRnti();
  std::cout<<"rnti................"<<(uint32_t)rnti<<"\n";

  uint16_t cellId = ueLteDevice->GetRrc()->GetCellId();
  NS_LOG_UNCOND("The UE rnti is " << rnti << " and the cellId is " << cellId);

  uint16_t enb_cellId = enbDevice->GetCellId();
  NS_LOG_UNCOND("The ENB cellId is " << enb_cellId);


  // remove the user from the eNB
  Ptr<LteEnbRrc> enbRrc = enbDevice->GetRrc();
  Ptr<LteEnbMac> enbMac = enbDevice->GetMac();
  Ptr<UeManager> ueMag = enbRrc-> GetUeManager (rnti);
  //enum sta = ueMag->GetState ();
  //enbMac-> GetLteEnbCmacSapProvider ()-> ReleaseLc( rnti, 1 );

  Ptr<LteUeRrc> ueRrc = ueLteDevice->GetRrc(); // optimize this call
  std::cout<<"At time "<< Simulator::Now().GetSeconds() << "s UE start to Disconnect to ENB "<<"\n";
  //enbRrc->RemoveUe( rnti );

  ueRrc->GetAsSapProvider()->Disconnect(); // now in IDLE_CAMPED_NORMALLY
}

void
reAttach(Ptr<NetDevice> ueDev) 
{
  Ptr<LteUeRrc> ueRrc = ueDev->GetObject<LteUeNetDevice> ()->GetRrc();
  ueRrc->GetAsSapProvider()->Connect();

As a side note,you can search the thread to find other solution.

Best,
Hongyu.
 
Reply all
Reply to author
Forward
0 new messages