Greetings!
I am new to NS, just downloaded NS2.35. I wish to use
NS3 for simulating WSN. On browsing through the examples I came across
example wsn-ping6.cc. Need help on few queries regarding the same:
I tried creating network with 100 nodes and allotted random positions to those (this was a minor change as listed below):
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
Ptr <UniformRandomVariable> x= CreateObject <UniformRandomVariable>();
Ptr<ListPositionAllocator> nodesPositionAlloc = CreateObject<ListPositionAllocator> ();
int nodeCount, xPos, yPos;
for (nodeCount=1; nodeCount<=100; nodeCount++)
{
xPos=((int)(x->GetValue()*1000))%100+1; yPos=((int)(x->GetValue()*1000))%100+1;
std::cout << "Adding node at position (" << xPos << ", " << yPos << ")" << std::endl;
nodesPositionAlloc->Add (Vector (xPos, yPos, 0.0));
}
mobility.SetPositionAllocator (nodesPositionAlloc);
mobility.Install (nodes);
Now I wish to simulate Direct communication between nodes and the sink and I don't know how to proceed.
I understand this would require:
1. Creating a sink
2. Making the nodes send data packets to the sink after fixed time intervals
3. I also need to compute remaining energy after each communication.
Regards,
Jaspal Singh.