[ndnSIM] Inducing waiting delay in nodes and no member named GetObject error

lahmer ilyas ilyaslahmer93 at gmail.com
Sat Mar 11 16:06:01 PST 2017


Hi To get The position of a node you can do the following :
#include <ns3/mobility-module>
#include<ns3/core-module>

ns3::Ptr<ns3::Node> node = ns3::NodeList::GetNode(ns3::Simulator::GetContext());
ns3::Ptr<ns3::MobilityModel> mobility = node->GetObject<ns3::MobilityModel>();
ns3::Vector current = mobility->GetPosition();
std::cout<<"Node Position"<<current<<std::endl;






On Wed, Mar 8, 2017 at 12:57 AM Spyridon (Spyros) Mastorakis <
mastorakis at cs.ucla.edu> wrote:

Hi,

unfortunately, I am not familiar with the mobility models of NS-3.

You can try to use the ScheduleWithContext method and see if that will work:

https://www.nsnam.org/doxygen/classns3_1_1_simulator.html#a5ba9b2de598375791433f1bb9ba9ca83
http://thread.gmane.org/gmane.network.simulator.ns3.user/31400

Thanks,

Spyridon (Spyros) Mastorakis
Personal Website: http://cs.ucla.edu/~mastorakis/
Internet Research Laboratory
Computer Science Department
UCLA

On Mar 7, 2017, at 12:50 PM, Rajvardhan Deshmukh <rdeshmukh at umass.edu>
wrote:



-------- Original Message --------
Subject: Fwd: Re: Inducing waiting delay in nodes
Date: 2017-03-06 12:16
From: Rajvardhan Deshmukh <rdeshmukh at umass.edu>
To: ndnsim at lists.cs.ucla.edu

Thanks Spyridon i renamed the strategy and the .cpp and hpp names and
it
worked.
Also, i wanted to get the position of the nodes in the forwarding
strategy.
1.i tried directly using the
using namespace ns3;
using namespace fw;
Ptr<MobilityModel>model=GetObject<MobilityModel>();
Vector position= model.GetPosition();
-------------------------
error: 'GetObject' was not declared in this scope

https://github.com/cawka/ndnSIM-nom-rapid-car2car/blob/master/extensions/ndn-fw-v2v.cc#L99

2.also inducing delay using following:
Simulator::Schedule(Seconds(Ndelay),
&WaitStrategy::SendAfterDelay,pitEntry,outFace,interest);
void WaitStrategy::SendAfterDelay(shared_ptr<pit::Entry>&
pitEntry,const Face outFace,const Interest& interest)
{
this->sendInterest(pitEntry, outFace, interest);
}

https://github.com/named-data-ndnSIM/ndnSIM/blob/a9d889b7a787842d45c86c67bc21d44853b03b7f/apps/ndn-consumer-cbr.cpp#L85

https://github.com/named-data-ndnSIM/ndnSIM/blob/5ea3322623a0550799431f25b2fc4e7e4df5c046/model/ndn-app-link-service.cpp#L55

---------------------------------------------------------------------------------------------------

gives error:
error: use of deleted function 'nfd::face::Face::Face(const
nfd::face::Face&)'
Simulator::Schedule(Seconds(Ndelay),
&WaitStrategy::SendAfterDelay,pitEntry,outFace,interest);
error: candidate is: void

nfd::fw::WaitStrategy::SendAfterDelay(std::shared_ptr<nfd::pit::Entry>&,

nfd::face::Face, const ndn::Interest&)
Thanks,
Raj


_______________________________________________
ndnSIM mailing list
ndnSIM at lists.cs.ucla.edu
http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170312/dcbf54cf/attachment-0001.html>


More information about the ndnSIM mailing list