Vanita Patil
unread,Jun 17, 2014, 2:53:59 AM6/17/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ns-3-...@googlegroups.com
hello sir,
i created 4 nodes one source and 3 sink nodes and getting problem
please any body help me out
error
Program received signal SIGSEGV, Segmentation fault.
0x0805f142 in ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Ref (this=0x179) at ./ns3/simple-ref-count.h:94
94 NS_ASSERT (m_count < std::numeric_limits<uint32_t>::max());
(gdb) where
#0 0x0805f142 in ns3::SimpleRefCount<ns3::Object, ns3::ObjectBase, ns3::ObjectDeleter>::Ref (this=0x179) at ./ns3/simple-ref-count.h:94
#1 0xb6c0c6fa in ns3::Ptr<ns3::DeviceEnergyModel>::Acquire (this=0xbffff328) at ./ns3/ptr.h:410
#2 0xb6aa9e05 in ns3::Ptr<ns3::DeviceEnergyModel>::Ptr (this=0xbffff328, o=...) at ./ns3/ptr.h:441
#3 0xb6ac15c3 in ns3::DeviceEnergyModelContainer::Get (this=0xbfffee80, i=3) at ../src/energy/model/device-energy-model-container.cc:84
#4 0x0805a72c in main (argc=2, argv=0xbffff504) at ../scratch/cl.cc:787
program
/** Internet stack **/
InternetStackHelper internet;
internet.Install (networkNodes);
Ipv4AddressHelper ipv4;
NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer i = ipv4.Assign (devices);
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Ptr<Socket> recvSink = Socket::CreateSocket (networkNodes.Get (1), tid); // node 1, receiver
InetSocketAddress local = InetSocketAddress (Ipv4Address::GetAny (), 80);
recvSink->Bind (local);
recvSink->SetRecvCallback (MakeCallback (&ReceivePacket));
Ptr<Socket> source = Socket::CreateSocket (networkNodes.Get (0), tid); // node 0, sender
InetSocketAddress remote = InetSocketAddress (Ipv4Address::GetBroadcast (), 80);
source->SetAllowBroadcast (true);
source->Connect (remote);
Ptr<Socket> source1 = Socket::CreateSocket (networkNodes.Get (2), tid); // node 0, sender
InetSocketAddress remote1 = InetSocketAddress (Ipv4Address::GetBroadcast (), 80);
source->SetAllowBroadcast (true);
source->Connect (remote1);
Ptr<Socket> source2 = Socket::CreateSocket (networkNodes.Get (3), tid); // node 0, sender
InetSocketAddress remote2 = InetSocketAddress (Ipv4Address::GetBroadcast (), 80);
source->SetAllowBroadcast (true);
source->Connect (remote2);
/** connect trace sources **/
/***************************************************************************/
// all sources are connected to node 1
// energy source
Ptr<BasicEnergySource> basicSourcePtr = DynamicCast<BasicEnergySource> (sources.Get (1));
basicSourcePtr->TraceConnectWithoutContext ("RemainingEnergy", MakeCallback (&RemainingEnergy));
// device energy model
Ptr<DeviceEnergyModel> basicRadioModelPtr =
basicSourcePtr->FindDeviceEnergyModels ("ns3::WifiRadioEnergyModel").Get (0);
NS_ASSERT (basicRadioModelPtr != NULL);
basicRadioModelPtr->TraceConnectWithoutContext ("TotalEnergyConsumption", MakeCallback (&TotalEnergy));
Ptr<DeviceEnergyModel> basicRadioModelPtr2 =
basicSourcePtr->FindDeviceEnergyModels ("ns3::WifiRadioEnergyModel").Get (2);
NS_ASSERT (basicRadioModelPtr2 != NULL);
basicRadioModelPtr2->TraceConnectWithoutContext ("TotalEnergyConsumption", MakeCallback (&TotalEnergy));
Ptr<DeviceEnergyModel> basicRadioModelPtr3 =
basicSourcePtr->FindDeviceEnergyModels ("ns3::WifiRadioEnergyModel").Get (3);
NS_ASSERT (basicRadioModelPtr3 != NULL);
basicRadioModelPtr3->TraceConnectWithoutContext ("TotalEnergyConsumption", MakeCallback (&TotalEnergy));
/***************************************************************************/
// steg();
/** simulation setup **/
// start traffic
wifiPhy.EnablePcap ("cl", devices);
AnimationInterface anim ("cl.xml");
anim.EnablePacketMetadata (true);
Simulator::Schedule (Seconds (0.0), &GenerateTraffic, source, PpacketSize,
networkNodes.Get (0), numPackets, interPacketInterval);
Simulator::Stop (Seconds (2.0));
Simulator::Run ();
Simulator::Schedule (Seconds (2.0), &GenerateTraffic, source1, PpacketSize,
networkNodes.Get (2), numPackets, interPacketInterval);
Simulator::Stop (Seconds (4.0));
Simulator::Run ();
Simulator::Schedule (Seconds (4.0), &GenerateTraffic, source2, PpacketSize,
networkNodes.Get (3), numPackets, interPacketInterval);
//steg();
Simulator::Stop (Seconds (6.0));
Simulator::Run ();
/*
//steg();
Simulator::Schedule (Seconds (4.0), &GenerateTraffic, source, PpacketSize,
networkNodes.Get (0), numPackets, interPacketInterval);
Simulator::Stop (Seconds (6.0));
Simulator::Run ();
*/
Simulator::Destroy ();
return 0;
}