assert failed. cond="ipv4", msg="Ipv4AddressHelper::Assign(): NetDevice is associated with a node without IPv4 stack installed -> fail (maybe need to use InternetStackHelper?)", file=../src/internet/helper/ipv4-address-helper.cc, line=145
Command ['/home/Roshni/ns-allinone-3.20/ns-3.20/build/scratch/ourpaperFinal'] terminated with signal SIGABRT. Run it under a debugger to get more information (./waf --run <program> --command-template="gdb --args %s <args>"
int main(int argc, char *argv[])
{
uint32_t nMobile = 1;
uint32_t nServer = 1;
uint32_t nWifi = 16;
bool verbose = true;
if (verbose)
{
LogComponentEnable ("UdpEchoServerApplication", LOG_LEVEL_INFO);
}
// enable rts cts all the time.
Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0"));
// disable fragmentation
Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200"));
// 1. Create the nodes and hold them in a container
NodeContainer server;
server.Create (nServer); //create a server node
NodeContainer smartPhone;
smartPhone.Create (nMobile); //create a mobile node
NodeContainer wifiApNode ;
wifiApNode.Create(nWifi); //create access point
NodeContainer wifiAp;
for(uint32_t i=0;i<nWifi;i++)
{
wifiAp.Add(wifiApNode.Get(i));
}
WifiHelper wifi = WifiHelper::Default ();
MobilityHelper mobility;
YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
phy.SetChannel (channel.Create ());
//WifiHelper wifi = WifiHelper::Default ();
wifi.SetRemoteStationManager ("ns3::AarfWifiManager");
NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
Ssid ssid = Ssid ("wifi-default");
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
//3. Set up MAC for AP
mac.SetType ("ns3::ApWifiMac",
"Ssid", SsidValue (ssid),
"BeaconGeneration", BooleanValue (true),
"BeaconInterval", TimeValue (Seconds (5)));
NetDeviceContainer apDevice;
apDevice = wifi.Install (phy, mac, wifiAp);
//add mobility
Ptr<ListPositionAllocator> positionAlloc = CreateObject <ListPositionAllocator>();
for (int j = 0; j < 4; ++j)
{
for (int i = 0; i < 4; ++i)
{
positionAlloc ->Add(Vector(i*100, j*100, 0)); // apn
}
}
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (wifiAp);
// 5.Add Internet layers stack
InternetStackHelper stack;
stack.Install (wifiAp);
// 6. Assign IP address to each device
Ipv4AddressHelper ipv4;
NS_LOG_INFO ("Assign IP Addresses.");
ipv4.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interface = ipv4.Assign (apDevice);
TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
Simulator::Run ();
Simulator::Destroy ();
return 0;
}