how to get mobility model from ns2mobilityhelper

1,823 views
Skip to first unread message

Konstantinos

unread,
Feb 27, 2012, 9:03:03 AM2/27/12
to ns-3-...@googlegroups.com
Hi all,

I want to use Ns2MobilityHelper with LTE module and from the LTE example I see that I can add the mobility of a node through the LTE helper as follows:

Ptr<ConstantVelocityMobilityModel> ueMobility = CreateObject<ConstantVelocityMobilityModel> ();
lte.AddMobility (ue[i]->GetPhy (), ueMobility);

However, the AddMobility(Ptr<LtePhy> phy, Ptr<MobilityModel>m) requires a pointer to a mobility model.

I want to use the Ns2MobilityHelper to load the traces of the nodes, and I see that it has a method to get a pointer to mobility model
Ptr<ConstantVelocityMobilityModel> GetMobilityModel (std::string idString, const ObjectStore &store) const;
but I can't find how I can use it. What is the idString and what is the &store?
idString is the "/NodeList/[i]"

I'm trying something like this:

// Create Ns2MobilityHelper with the specified trace log file as parameter
Ns2MobilityHelper ns2 = Ns2MobilityHelper (traceFile);
ns2.Install (); // configure movements for each node, while reading trace file
lte.AddMobility (ue[i]->GetPhy (), ns2.GetMobilityModel() );

but I don't know what arguments to pass in the GetMobilityModel.

Regards,
Konstantinos

Martin Giachino

unread,
Feb 28, 2012, 1:56:35 PM2/28/12
to ns-3-...@googlegroups.com
Hi Konstantinos, the problem is that the getMobilityModel is a method from a private class.

I didn't use LTE, but I think that a workaroud could be create a nodecontainer including all nodes (that are present in the trace file), and after that, create and install the movements to every node:
Ns2MobilityHelper ns2 = Ns2MobilityHelper (traceFile);
ns2.install()

Once that it is made, I think it is not necessary to use lte.AddMobility (because movements are already configures). After that, you are still able to use lte helper for the rest of the things you need (set the phy, ip address and so on).

Martín



--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/qcI1gFSyfhUJ.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.



--
Martín

Konstantinos

unread,
Feb 28, 2012, 2:39:29 PM2/28/12
to ns-3-...@googlegroups.com
Dear Martin,


On Tuesday, 28 February 2012 18:56:35 UTC, Martín Giachino wrote:
Hi Konstantinos, the problem is that the getMobilityModel is a method from a private class.

The GetMobiltyModel is a public method of the ns2-mobility-helper and returns a pointer to ConstantVelocityMobilityModel but it requires two arguments, a string and a ObjectStore& which are not defined in the documentation or in any example in order to see what is needed.
 

I didn't use LTE, but I think that a workaroud could be create a nodecontainer including all nodes (that are present in the trace file), and after that, create and install the movements to every node:
Ns2MobilityHelper ns2 = Ns2MobilityHelper (traceFile);
ns2.install()

The thing is that I have 2 node containers: one for UE - mobile that I want to use the tracefile and one container for the eNB (which I use constant position mobility model. If for example I have 10 UE and 1 eNB and the trace file has the information for these 10 UE nodes, will the ns2.Install() only on the 10 UE ?? Is there any particular order I have to create these containers (eg first the UE container)?
 
Once that it is made, I think it is not necessary to use lte.AddMobility (because movements are already configures). After that, you are still able to use lte helper for the rest of the things you need (set the phy, ip address and so on).

Are you sure about it? Because in the example of LTE I see they use this AddMobility.
 

Martín



I will have a look at your proposal and come up with comments later.

Best Regards,
Konstantinos
 
El 27 de febrero de 2012 12:03, Konstantinos <dinos.k...@gmail.com> escribió:
Hi all,

I want to use Ns2MobilityHelper with LTE module and from the LTE example I see that I can add the mobility of a node through the LTE helper as follows:

Ptr<ConstantVelocityMobilityModel> ueMobility = CreateObject<ConstantVelocityMobilityModel> ();
lte.AddMobility (ue[i]->GetPhy (), ueMobility);

However, the AddMobility(Ptr<LtePhy> phy, Ptr<MobilityModel>m) requires a pointer to a mobility model.

I want to use the Ns2MobilityHelper to load the traces of the nodes, and I see that it has a method to get a pointer to mobility model
Ptr<ConstantVelocityMobilityModel> GetMobilityModel (std::string idString, const ObjectStore &store) const;
but I can't find how I can use it. What is the idString and what is the &store?
idString is the "/NodeList/[i]"

I'm trying something like this:

// Create Ns2MobilityHelper with the specified trace log file as parameter
Ns2MobilityHelper ns2 = Ns2MobilityHelper (traceFile);
ns2.Install (); // configure movements for each node, while reading trace file
lte.AddMobility (ue[i]->GetPhy (), ns2.GetMobilityModel() );

but I don't know what arguments to pass in the GetMobilityModel.

Regards,
Konstantinos

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/qcI1gFSyfhUJ.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.



--
Martín

Martin Giachino

unread,
Feb 28, 2012, 3:52:10 PM2/28/12
to ns-3-...@googlegroups.com
Hi again,

Hi Konstantinos, the problem is that the getMobilityModel is a method from a private class.

The GetMobiltyModel is a public method of the ns2-mobility-helper and returns a pointer to ConstantVelocityMobilityModel but it requires two arguments, a string and a ObjectStore& which are not defined in the documentation or in any example in order to see what is needed.

Here is the .h file http://code.nsnam.org/ns-3.13/file/41645935dd75/src/mobility/helper/ns2-mobility-helper.h. There you could find the ObjectStore class definition.


I didn't use LTE, but I think that a workaroud could be create a nodecontainer including all nodes (that are present in the trace file), and after that, create and install the movements to every node:
Ns2MobilityHelper ns2 = Ns2MobilityHelper (traceFile);
ns2.install()

The thing is that I have 2 node containers: one for UE - mobile that I want to use the tracefile and one container for the eNB (which I use constant position mobility model. If for example I have 10 UE and 1 eNB and the trace file has the information for these 10 UE nodes, will the ns2.Install() only on the 10 UE ?? Is there any particular order I have to create these containers (eg first the UE container)?

That is why I told you that I never used LTE! :D
Yes, you could do it. I if you create at first the node container for UE an use ns2.install over them, it will work. After that, you can create the second node container and use the lte helper AddMobility method to asign them the constantpositionmobilitymodel to eNB.
 

Once that it is made, I think it is not necessary to use lte.AddMobility (because movements are already configures). After that, you are still able to use lte helper for the rest of the things you need (set the phy, ip address and so on).

Are you sure about it? Because in the example of LTE I see they use this AddMobility.

Again, Im not sure about nothing related to LTE :D.....well, if create first the UE and after that eNB you will be using AddMobility, but not for all. The objective of a helper class is to easy our work, but you allways could make configurations over some particular nodes if you need it (like set different mobility pattern :D)



 
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/J_Rf3NfZfKEJ.

To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.



--
Martín

Konstantinos

unread,
Feb 29, 2012, 8:53:04 AM2/29/12
to ns-3-...@googlegroups.com
Dear Martin,

Even though we can use ns2mobilityhelper to install the mobility to the nodes (as we have already discussed), LTE requires the mobility model pointer so that it can configure the downlink channel

lte.AddDownlinkChannelRealization (enbMobility, ueMobility, ue[i]->GetPhy ());

So, I'm again faced with the problem of how to get the mobility from the ns2helper class.
I have looked at the header file and noticed that the GetMobilityModel method is not public as you have mentioned. I had falsely referred to it as public.

Therefore, I will try to use a more general approach to get the mobility from the node after it is installed.

  // CONFIGURE MOBILITY
  Ptr<ConstantPositionMobilityModel> enbMobility = CreateObject<ConstantPositionMobilityModel> ();
  enbMobility->SetPosition (Vector (0.0, 0.0, 0.0));
  lte.AddMobility (enb->GetPhy (), enbMobility);


  // Create Ns2MobilityHelper with the specified trace log file as parameter
  Ns2MobilityHelper ueMobility = Ns2MobilityHelper (traceFile);
  ueMobility.Install (); // configure movements for each node

  for (int i = 0; i < nbUE; i++)
    {
      lte.AddDownlinkChannelRealization (enbMobility, ueNodes.Get(i)->GetObject<Mobility>(), ue[i]->GetPhy ());

Igor Lopez Orbe

unread,
Apr 8, 2014, 10:04:08 AM4/8/14
to ns-3-...@googlegroups.com
Hello Konstantinos,

I am trying to work with LTE UE with a traceFile imported by Ns2MobilityHelper. However I get errors with the mobility model. Do you know how to make work LTE with Ns2MobilityHelper?

Cheers,

Igor
Hi again,

To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.



--
Martín

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/J_Rf3NfZfKEJ.

To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.



--
Martín
Hi again,

To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.



--
Martín

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/J_Rf3NfZfKEJ.

To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.



--
Martín

Konstantinos

unread,
Apr 8, 2014, 12:23:24 PM4/8/14
to ns-3-...@googlegroups.com
What type of errors? If they are not related to the one I had, please open new thread.

I think that I have already already solve the problem and provided how in my previous post you replied.

Igor Lopez Orbe

unread,
Apr 9, 2014, 4:50:00 AM4/9/14
to ns-3-...@googlegroups.com
When I try to do what you did ns3 tell me that lte.AddDownlinkChannelRealization method is not available.

I think lte-helper doesn't implement this method anymore. Any other idea about how this could be done?

https://www.nsnam.org/doxygen/classns3_1_1_lte_helper.html#details

Thanks in advance. Regards,

Igor

Konstantinos

unread,
Apr 9, 2014, 4:53:27 AM4/9/14
to ns-3-...@googlegroups.com
Then, you do not need to do it and the problem is fixed. 

What is the problem you get with the Ns2MobilityHelper?

Igor Lopez Orbe

unread,
Apr 9, 2014, 5:45:01 AM4/9/14
to ns-3-...@googlegroups.com
The problem is I want to use the mobility pattern loaded by Ns2MobilityHelper in Ues and it supose that this mobility is loaded automatically with the ns2.Install(). In order to load the mobility in Ues and not in eNBs I do it as follow:

 //Create UEs and eNBs
  NodeContainer ueNodes;
  ueNodes.Create (numberOfUes);
  //install ns2 in the mobile node
  ns2.Install ();
  NodeContainer enbNodes;
  enbNodes.Create (numberOfEnbs);

Then I set up the mobility for eNBs:

  MobilityHelper enbMobility;
  enbMobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
  enbMobility.SetPositionAllocator(enbPositionAlloc);
  enbMobility.Install(enbNodes);

And then I install UeDevices (two devs in the same Ue):

  // Install LTE Devices in eNB and UEs

  NetDeviceContainer enbLteDevs = lteHelper->InstallEnbDevice (enbNodes);
  NetDeviceContainer ueLteDev1, ueLteDev2;
  ueLteDev1 = lteHelper->InstallUeDevice (ueNodes.Get(0));
  ueLteDev2 = lteHelper->InstallUeDevice (ueNodes.Get(0));


But then when I run the simulation I get this error:

  Config::SetDefault ("ns3::LteEnbPhy::Txassert failed. cond="mm", msg="MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()", file=../src/lte/helper/lte-helper.cc, line=563
terminate called without an active exception Power", DoubleValue (enbTxPowerDbm));


The point is I don't know how to set the MobilityModel in combination with ns2MobilityHelper. With ueMobility.SetMobilityModel I don't see any option to import the mobility model.


Any idea?

Regards,

Igor

Konstantinos

unread,
Apr 9, 2014, 6:34:51 AM4/9/14
to ns-3-...@googlegroups.com
Is the number of UEs in your simulation, the same as the number of nodes you have in the trace-file you load for NS2Mobility?

Igor Lopez Orbe

unread,
Apr 9, 2014, 6:42:15 AM4/9/14
to ns-3-...@googlegroups.com
Yes it is. In both cases "1"


--
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/Z1UnbY_P7rc/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.

Konstantinos

unread,
Apr 9, 2014, 6:59:52 AM4/9/14
to ns-3-...@googlegroups.com
You should verify that the the moblity has been installed on the node.
Perhaps the trace file is not loaded properly (it is not loaded). 

Try a simple scenario (the Ns2MobiltyHelper-example code) to verify that the mobility is installed. 

Igor Lopez Orbe

unread,
Apr 10, 2014, 8:03:49 AM4/10/14
to ns-3-...@googlegroups.com
I have checked the traceFile with the ns2-mobility-trace model and it works well. Then I have tried to do the same with the lena-x2-handover-measures as follow but the node doesn't apparently move because it doesn't chance the eNB association:

http://pastebin.com/8HzEYyJj

As the mobility trace is rectangular I have set the eNB also making a rectangle manually:

  Vector enbPosition1 (200,200,0);
  enbPositionAlloc->Add (enbPosition1);
  Vector enbPosition2 (5200,200,0);
  enbPositionAlloc->Add (enbPosition2);
  Vector enbPosition3 (5200,5200,0);
  enbPositionAlloc->Add (enbPosition3);
  Vector enbPosition4 (200,5200,0);
  enbPositionAlloc->Add (enbPosition4);

And in order to set the movement of the Ue I install the ns2 and I do just before creating the eNB:

  // Install Mobility Model in Ue
  MobilityHelper ueMobility;
  ueMobility.SetMobilityModel ("ns3::ConstantVelocityMobilityModel");
  ueMobility.Install (ueNodes);
 
  //install ns2 in the mobile node
  ns2.Install ();
//  ueNodes.Get (0)->GetObject<MobilityModel> ()->SetPosition (Vector (0, yForUe, 0));
//  ueNodes.Get (0)->GetObject<ConstantVelocityMobilityModel> ()->SetVelocity (Vector (speed, 0, 0));

I do not know how can it be the problem, I get no error during the compilation and running.

Any idea?

PS:I attach the .tcl just in case.

Thanks in advance,

Igor



--
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/Z1UnbY_P7rc/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.
ns2mobility8.3.tcl

Konstantinos

unread,
Apr 10, 2014, 8:27:42 AM4/10/14
to ns-3-...@googlegroups.com
Hi, 

I just run your code on ns-3.19 (with one modification for the EPC helper due to API change).
It runs without any other compilation problem.
The node is moving, as expected. The fact that you did not see any handover is because the UE did not reach any other enb.
The log file with the movement of the UE finishes with this line

+125000000000.0ns POS: x=945.97, y=-1.65, z=0; VEL:7.03, y=0, z=0

which means that the simulation lasted 125seconds and the UE has reached the position (945.97, -1.65) which lies within the coverage of enb1 (enb2 is at 5200,200).

Since your problem (if there is a problem) is not related to the subject of this thread, please do not ask further questions here. Open a new one. 
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.

Igor Lopez Orbe

unread,
Apr 10, 2014, 10:04:36 AM4/10/14
to ns-3-...@googlegroups.com
Hi,

Sorry Konstantinos but I think with my code you cannot generate this log file, this logfile is generated with the CourseChange of ns2-mobility-trace which is not included in my code.
Moreover in my simulation the rsrp value of DlRsrpSinrStats.txt doesn't chance and this means the node is not moving because as soon as the distance between the UE and the eNB chances this value increases or decreases. Are you sure this log is generated by my code?

I still think the problem is that the UE is not loading correctly the mobility.

Cheers,

Igor


To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

Konstantinos

unread,
Apr 10, 2014, 10:53:14 AM4/10/14
to ns-3-...@googlegroups.com
Yes, I added the CourseChange in order to verify that the node is moving. 
That does not change anything in the movement of the node, on the contrary it just logs it.

I do not know how RSRP value changes; I mean how often and what should be the distance from the enb to see change in that value. 
Again, since your question is not related to the subject, open new thread!

Konstantinos

unread,
Apr 10, 2014, 11:29:01 AM4/10/14
to ns-3-...@googlegroups.com
Just an update here, if you look couple of posts back, I told you to make sure that the node IDs in the trace file match the node IDs of the moving node you want.

What was actually happening, the moving node was node_0 which was the PGW!
The FIRST node to be created (node_0) should be a UE, in order to match the node ID of the trace file.

So, just put these lines just before you create the LTE/EPC helper (which creates the PGW node).
  NodeContainer ueNodes;
  ueNodes
.Create (numberOfUes);

Igor Lopez Orbe

unread,
Apr 10, 2014, 11:42:46 AM4/10/14
to ns-3-...@googlegroups.com
Ok, now it works. I didn't take into account the PGW node!

Thanks Konstantinos!

Regards,

Igor


To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.

nabil torjemen

unread,
Feb 28, 2015, 3:39:28 PM2/28/15
to ns-3-...@googlegroups.com
Hi,
Konstantinos, in your code :
   lte.
AddDownlinkChannelRealization (enbMobility, ueNodes.Get(i)->GetObject<Mobility>(), ue[i]->GetPhy ());

lte is an Ltehelper ?
Best regards.
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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

--
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/Z1UnbY_P7rc/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 http://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.

nabil torjemen

unread,
Feb 28, 2015, 5:05:07 PM2/28/15
to ns-3-...@googlegroups.com
Hi,
Is the following code is enough to set the mobility of LTE Ue imported by the Bonnmotion tool:

uint16_t numberOfUes
= 10;
std
::string traceFile = "src/mobility/examples/bonnmotion.ns_movements";

// Install Mobility Model for Ues position from bonnmotion tool


 
Ns2MobilityHelper ns2 = Ns2MobilityHelper (traceFile);

   
// create Ues
 
NodeContainer ueNodes;
  ueNodes
.Create(numberOfUes);
 
//
  ns2
.Install(); //configure movements for each node, while reading trace file

Best regards.

Konstantinos

unread,
Mar 1, 2015, 6:33:13 AM3/1/15
to ns-3-...@googlegroups.com
Hi,

The trace file in the example has only one node, so it can not be used in this code snipped where you have 10 nodes.
The code you have used seems correct, but you have to change the file and generate one that fits your needs.

nabil torjemen

unread,
Mar 5, 2015, 6:45:19 AM3/5/15
to ns-3-...@googlegroups.com
Hi,
OK thanks for your reply.
However, using this code,the Ns2MobilityHelper has not the nodecontainer as input. it is not strange ?
if for example there more than one nodecontainer, which one will be used by Ns2MobilityHelper ?
Best regards.

Konstantinos

unread,
Mar 5, 2015, 6:47:05 AM3/5/15
to ns-3-...@googlegroups.com
Please read the code in the Install() method and you will find your answer.

nabil torjemen

unread,
Mar 5, 2015, 8:28:05 AM3/5/15
to ns-3-...@googlegroups.com
Hi,
I have already read the code related to the install method:
void
Ns2MobilityHelper::Install (void) const
{
 
Install (NodeList::Begin (), NodeList::End ());
}

template <typename T>
void
Ns2MobilityHelper::Install (T begin, T end) const
{
 
class MyObjectStore : public ObjectStore
 
{
public:
   
MyObjectStore (T begin, T end)
     
: m_begin (begin),
        m_end
(end)
   
{}
   
virtual Ptr<Object> Get (uint32_t i) const {
      T iterator
= m_begin;
      iterator
+= i;
     
if (iterator >= m_end)
       
{
         
return 0;
       
}
     
return *iterator;
   
}
private:
    T m_begin
;
    T m_end
;
 
};
 
ConfigNodesMovements (MyObjectStore (begin, end));
}



I think that the code take as input the node list extracted from the tracefile and then config their mobility.
However,I can't see how this list is injected into the nodecontainer.
Br

nabil torjemen

unread,
Mar 9, 2015, 11:18:51 AM3/9/15
to ns-3-...@googlegroups.com
Hi,
I got the following error:
msg="MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()", file=../src/lte/helper/lte-helper.cc, line=633

terminate called without an active exception

when trying to use your proposed code, I can't find the method AddDownlinkChannelRealization in the lte-helper.
Br

Le jeudi 5 mars 2015 14:35:10 UTC+1, Konstantinos a écrit :
No, it is not taking as input the trace file node list... but the ns3 nodelist (https://www.nsnam.org/doxygen/classns3_1_1_node_list.html)
Then it compares the ID of the node in the node list with the ID in the trace file to configure the movement of the node.

Read the ns2 trace file and configure the movement patterns of all nodes contained in the global ns3::NodeList whose nodeId is matches the nodeId of the nodes in the trace file.

Konstantinos

unread,
Mar 9, 2015, 3:04:57 PM3/9/15
to ns-3-...@googlegroups.com
Hi,

The error output is clear. You need to install the mobility on the nodes BEFORE you install the UE NetDevice.

I do not know to which proposed code you are referring to. If you mean the one posted 3years ago, then probably the API has evolved. 

nabil torjemen

unread,
Mar 9, 2015, 5:45:20 PM3/9/15
to ns-3-...@googlegroups.com
Hi,
it is your code posted 3 years ago.
I have try to install the mobility model using the following code:
// Install Mobility Model for Ues position from bonnmotion tool
 
Ns2MobilityHelper ns2 = Ns2MobilityHelper (traceFile);
     
// create Ues
 
NodeContainer ueNodes;
  ueNodes
.Create(numberOfUes);

 
  mobility
.SetMobilityModel ("ns3::ConstantVelocityMobilityModel");
  mobility
.Install(ueNodes);

 
  ns2
.Install(); //configure movements for each node, while reading trace file

however, I get now the following error:

Program received signal SIGSEGV, Segmentation fault.
0xb45865b0 in __dynamic_cast ()
   from /usr/lib/i386-linux-gnu/libstdc++.so.6

Best regards.

Konstantinos

unread,
Mar 9, 2015, 6:17:04 PM3/9/15
to ns-3-...@googlegroups.com
Please use the examples contained in the ns-3 release you use, since the API has changed after 3yrs.

Regarding your code snippet, you install two mobility models; one based on the trace file and another on ConstantVelocity. Wonder why you get an error...
You only need the ns2mobilityhelper 

nabil torjemen

unread,
Mar 10, 2015, 3:46:57 PM3/10/15
to ns-3-...@googlegroups.com
Hi ,
I find the function GetMobilityModel which is used to create the mobility model in ns2helper.
however, its pamaters are not easy to set:
idStringstring name for a node
storeObject store containing ns-3 mobility models
the idString is the nodecontainer name ???

Tommaso Pecorella

unread,
Mar 10, 2015, 5:52:35 PM3/10/15
to ns-3-...@googlegroups.com
Hi,

I honestly can not understand what you are trying to do.
Kostantinos already explained how to use the helper, and I doubt that it could be explained in a clearer way.
1) You have to create a set of nodes.
2) You have to install the mobility on the nodes you created.
2a) if you created *more* nodes than the ones listed in the mobility trace file, the extra ones will not be moved (and they'll not have any mobility model associated).
2b) if you created *less* nodes than the ones listed in the mobility trace file, an error will occur.

That's it. No more, no less. You don't have to do anything more than this.

In order to install the mobility helper, you have TWO alternatives:
ns2helper.Install () // no arguments, it will use all the nodes created so far
or
ns2helper.Install (nodeContainer.Begin (), nodeContainer.End ()) // install the mobility on the nodes in the nodeContainer

The function you named (GetMobilityModel) is a private function, and it is not meant to be used by the users.

If, however, you're just trying to learn from the code, the function is pretty clear: it will return the ConstantVelocityMobilityModel object associated with the i-th node in the NodeContainer passed as the second argument.
The index i is passed as the first argument. The only trick is that the index is passed as a string and not as a number. Still, it must be a numerical index.
If no ConstantVelocityMobilityModel is found on the node, the function will create one and it will associate to the node.
However, if the i-th node is not found in the container, an error will be thrown.

Hope this helps, but... the GetMobilityModel function shouldn't be called by the user script. Ever.

Cheers,

T.

Konstantinos

unread,
Mar 10, 2015, 6:11:57 PM3/10/15
to ns-3-...@googlegroups.com
The whole thread was open 3yrs ago because of that reason; the GetMobilityModel is private and at that time LTE required it for UE installation.
However, as I have already mentioned the API has changed and that code is not valid any more. Use the examples provided with the ns-3 release you use and if for any reason you are using a 3yr old release just update!

Regards,
K.
...

nabil torjemen

unread,
Mar 11, 2015, 1:36:17 AM3/11/15
to ns-3-...@googlegroups.com
Hi Konstantinos  and Tommaso ;
Thing are more clear now.
Thanks for you both.
best regards.

nabil torjemen

unread,
Mar 15, 2015, 6:06:17 PM3/15/15
to ns-3-...@googlegroups.com
Hi for all;
The problem is not in the use of ns2helper. the following code is working well:
 // Install Mobility Model for Ues position from bonnmotion tool
 
Ns2MobilityHelper ns2 = Ns2MobilityHelper (traceFile);
     
// create Ues
 
NodeContainer ueNodes;
  ueNodes
.Create(numberOfUes);

 
  ns2
.Install(ueNodes.Begin(),ueNodes.End());
however , the error occur when trying to use lte helper to install device to the nodes:
NetDeviceContainer ueLteDevs = lteHelper->InstallUeDevice (ueNodes);

the returned error is :

assert failed. cond="mm", msg="MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()", file=../src/lte/helper/lte-helper.cc, line=636

terminate called without an active exception

in fact, the InstallUeDevice method is using the method InstallSingleUeDevice which try to set the mobility in the node using the following code:

Ptr<MobilityModel> mm = n->GetObject<MobilityModel> ();
  NS_ASSERT_MSG
(mm, "MobilityModel needs to be set on node before calling LteHelper::InstallUeDevice ()");
  dlPhy
->SetMobility (mm);
  ulPhy
->SetMobility (mm);

the MobilityModel object can support the ConstantVelocityMobilityModel which is defined in the ns2helper. So why the error occurs and how o fix it ?

Best regards.

Konstantinos

unread,
Mar 15, 2015, 6:28:16 PM3/15/15
to ns-3-...@googlegroups.com
Hi nabil,

the error is clear, that you need to install the mobility model before installing the UE netdevice. That means the ns2.Install() method has to be called BEFORE the lteHelper->InstallUeDevices(). 

If you have done that, then please attach your code to check if there is any bug.
...

nabil torjemen

unread,
Mar 16, 2015, 2:02:23 AM3/16/15
to ns-3-...@googlegroups.com
Hi,
I have already attach my code. It is as follow:
// Install Mobility Model for Ues position from bonnmotion tool
Ns2MobilityHelper ns2 = Ns2MobilityHelper (traceFile);
// create Ues
NodeContainer ueNodes;
ueNodes
.Create(numberOfUes);
ns2.Install(ueNodes.Begin(),ueNodes.End());

NetDeviceContainer
ueLteDevs = lteHelper->InstallUeDevice (ueNodes);

so then the ns2.install is used before InstallUeDevice

Tommaso Pecorella

unread,
Mar 16, 2015, 3:57:47 AM3/16/15
to ns-3-...@googlegroups.com
Hi,

just a doubt. How many nodes have you created, and how many nodes are in the mobility file ?

If the answer is "I created X nodes, and the mobility file contains Y nodes with X > Y", then I'll put you in my ban list for 2 weeks.

Cheers,

T.
...

nabil torjemen

unread,
Mar 16, 2015, 7:01:51 AM3/16/15
to ns-3-...@googlegroups.com
Hi,
It is the some number of node.
I have 10 uenode and the file include also 10 ue.
Best regards.

Konstantinos

unread,
Mar 16, 2015, 7:03:06 AM3/16/15
to ns-3-...@googlegroups.com
As I said, can you attach your code (all of it in a file) so we could test it.
Also attach the mobility file you use.

nabil torjemen

unread,
Mar 16, 2015, 8:48:20 AM3/16/15
to ns-3-...@googlegroups.com
Hi,
OK. Please find enclosed three files:
1- the script file.
2- the output of Bonnmotion.
3- the parameter of Bonnmotion simulation.

best regards.
nabil_offload.cc
nabil.movements
nabil.params

Konstantinos

unread,
Mar 16, 2015, 8:56:05 AM3/16/15
to ns-3-...@googlegroups.com
The 'nabil.movements' file you attached is not in the correct format for the Ns2MobilityHelper.

Valid trace files use the following ns2 statements (https://www.nsnam.org/docs/release/3.22/doxygen/classns3_1_1_ns2_mobility_helper.html): 

  $node set X_ x1
  $node set Y_ y1
  $node set Z_ z1
  $ns at $time $node setdest x2 y2 speed
  $ns at $time $node set X_ x1
  $ns at $time $node set Y_ Y1
  $ns at $time $node set Z_ Z1

nabil torjemen

unread,
Mar 16, 2015, 10:00:26 AM3/16/15
to ns-3-...@googlegroups.com
Hi,
OK. Thanks.
I have follow the bonnmotion manual to convert it to ns3 format.
Thanks again.
Br.
...

Konstantinos

unread,
Mar 5, 2015, 8:35:10 AM3/5/15
to ns-3-...@googlegroups.com
No, it is not taking as input the trace file node list... but the ns3 nodelist (https://www.nsnam.org/doxygen/classns3_1_1_node_list.html)
Then it compares the ID of the node in the node list with the ID in the trace file to configure the movement of the node.

Read the ns2 trace file and configure the movement patterns of all nodes contained in the global ns3::NodeList whose nodeId is matches the nodeId of the nodes in the trace file.
Reply all
Reply to author
Forward
0 new messages