Propagation Loss Model Not Being applied.

248 views
Skip to first unread message

Michael Albert

unread,
Feb 2, 2015, 1:10:51 PM2/2/15
to ns-3-...@googlegroups.com

I have been experimenting with wifi ad-hoc networks in NS-3 and am currently trying to demonstrate that the farther away the two nodes reside, the worse the connection gets. There are no compile or run-time errors when running WAF.

The Problem:

Though I have tried using the default constructor (which supposedly sets a propagation Loss model ofns3::LogDistancePropagationLossModel) There is no effect on the transmission bandwidth between nodes nor in the network jitter or lag when distance is changed. I then tried manually setting the propagation loss, which resulted in no connectivity when distance was set greater to 1.0. I am rather confused at this behavior. I feel that I am missing some value in my code that I should pass to ns-3 but cannot seem to find it. I have referenced example code but to no avail (http://www.nsnam.org/doxygen/wifi-example-sim_8cc_source.html).

I am using iperf in udp mode to measure the connection stats. I have two linux containers that are properly isolated and can communicate through ns-3 via the WAF script.

Source:

#include <iostream>
#include <fstream>
#include"ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/wifi-module.h"
#include "ns3/csma-module.h"
#include "ns3/tap-bridge-module.h"
#include "ns3/netanim-module.h"
#include "ns3/mobility-module.h"

using namespace ns3;

int main( int argc, char *argv[]){

uint32_t nNodes = 2;
CommandLine cmd;
cmd.Parse (argc, argv);

GlobalValue::Bind ("SimulatorImplementationType", StringValue ("ns3::RealtimeSimulatorImpl"));
GlobalValue::Bind ("ChecksumEnabled", BooleanValue (true));

NodeContainer nodes;
nodes.Create(nNodes);

CsmaHelper csma;

//csma.SetChannelAttribute ("DataRate", StringValue ("100Mbps"));
WifiHelper wifi = WifiHelper::Default();
wifi.SetStandard (WIFI_PHY_STANDARD_80211a);
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default ();
wifiMac.SetType ("ns3::AdhocWifiMac");

YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default ();
//wifiChannel.SetPropagationDelay("ns3::ConstantSpeedPropagationDelayModel");
//wifiChannel.AddPropagationLoss("ns3::FriisPropagationLossModel");
wifiChannel.AddPropagationLoss("ns3::LogDistancePropagationLossModel","Exponent", DoubleValue (3.0));

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();
wifiPhy.SetChannel (wifiChannel.Create ());
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue ("OfdmRate54Mbps"), "ControlMode",StringValue ("OfdmRate54Mbps"));
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
positionAlloc->Add (Vector (0.0, 0.0, 0.0));
positionAlloc->Add (Vector (10.0, 0.0, 0.0));
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install(nodes);
TapBridgeHelper wifiTapBridge;
wifiTapBridge.SetAttribute ("Mode", StringValue ("UseLocal"));


NodeContainer n_1 = NodeContainer(nodes.Get(0), nodes.Get(1));
NetDeviceContainer dev_1 = wifi.Install(wifiPhy,wifiMac,n_1);

wifiTapBridge.SetAttribute ("DeviceName", StringValue ("tap-0"));
wifiTapBridge.Install(nodes.Get(0), dev_1.Get(0));
wifiTapBridge.SetAttribute ("DeviceName", StringValue ("tap-1"));
wifiTapBridge.Install(nodes.Get(1), dev_1.Get(1));
// Run the simulation for 1 minute to give the user time to play around

Simulator::Stop (Seconds (600.));
csma.EnablePcapAll("radio",true);
wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO);Simulator::Run ();
Simulator::Destroy ();
}

Michael Albert

unread,
Feb 4, 2015, 11:18:10 AM2/4/15
to ns-3-...@googlegroups.com
Just wanted to update on the situation. By disabling fragmentation and not trying to override the default propagation loss model, I was able to notice a change in connectivity over distance. For reference, the distances with noted connectivity drops are 27-30 Meters for Ofdm Rate 54Mbps and 55-60m for Ofdm Rate 24Mbps.

This still leads me to point out that when I attempted to "override" or add a propagation loss model onto the sim, I would lose connectivity beyond a distance of 1m. I tried overriding with Friis, the default Log Distance, and Kun2600 and all had the same effect.

Thanks,
Mike

Tommaso Pecorella

unread,
Feb 4, 2015, 11:45:35 AM2/4/15
to ns-3-...@googlegroups.com
Hi,

check the helper sources (a bit convoluted, indeed).

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default ();

This is setting the default PropagationLossModel (LogDistance). When you call "YansWifiChannelHelper::AddPropagationLoss" you add another PropagationLossModel to the old one.
This is done to superimpose the effects of two models, typically a slow and a fast fading model. However, one of the two should be zero mean, which isn't the case.

What you have to do is... don't call "Default ()" (and remember to specify both Propagation and Delay models.

Cheers,

T.
Reply all
Reply to author
Forward
0 new messages