Hai everyone,
I am new to ns3 simulation. I have some questions regarding wireless module (I already posted a question which was more specific, here im explaining my target in details). Here is what im trying to do:
What i required ?
I need to measure the link quality of wireless links. To achieve this, I need to setup the topology. I.e the location of each nodes. Then, each node broadcasts frames at a fixed transmission power. On the receiver, the nodes will check the RSS and determine the link quality.
What I have done
I setup the topology and sending the frames with a fixed transmission power. Here is the main code part:
YansWifiChannelHelper wchanHelp = YansWifiChannelHelper::Default();
wchanHelp.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
wchanHelp.AddPropagationLoss ("ns3::LogDistancePropagationLossModel",
"Exponent", DoubleValue (3.0));
Ptr<YansWifiChannel> wifiChannel = wchanHelp.Create();
// setup of channel finished !
// 4: Physical layer [WifiPhy] statehelper class for WiFiphy
// select physical layer and connect to channel
YansWifiPhyHelper phyHelper = YansWifiPhyHelper::Default();
// all phydevices created by phyHelper should use this wifi channel to communicate -> bonding
phyHelper.SetChannel(wifiChannel);
phyHelper.Set ("ChannelNumber", UintegerValue (3));
phyHelper.Set ("TxPowerStart", DoubleValue (1)); // dBm (1.26 mW)
phyHelper.Set ("TxPowerEnd", DoubleValue (1)); // dBm (1.26 mW)
// PCAP using radio tap headers
phyHelper.SetPcapDataLinkType(YansWifiPhyHelper::DLT_IEEE802_11_RADIO);
// 2 : Higher MAC [WifiMac]
// Set it to adhoc mode configure High Mac Layer, and disable rate control (i.e. ConstantRateWifiManager)
// ns3::AdhocWifiMAC, does not generate beacons or send probs
NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default ();
wifiMacHelper.SetType ("ns3::AdhocWifiMac");
WifiHelper wifiHelper;
wifiHelper.SetStandard (WIFI_PHY_STANDARD_80211b);
wifiHelper.SetRemoteStationManager ("ns3::IdealWifiManager", "DefaultTxPowerLevel", UintegerValue (10));
std::string speed = "11Mbps";
std::string phyMode ("DsssRate"+ speed);
wifiHelper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
"DataMode",StringValue (phyMode),
"ControlMode",StringValue (phyMode));
What I need
I need to get the RSS at each node depending on the position. I was using radiotap header information to get this data. But the structure changed in from ns3 3.20 and I am unable to fetch any tag... So my question is, how can i get the RSS and other information of a packet received?? Below is the old working code inside receiveFrame callback function :
// extract information from radiotap header
auto it = packet->GetPacketTagIterator();
while(it.HasNext()){
NS_LOG_DEBUG("THERE IS TAG");
auto t = packet->GetByteTagIterator().Next();
if(t.GetTypeId() == RadiotapHeaderTag::GetTypeId()){
NS_LOG_DEBUG("Radiotap-Header tag found .... extracting");
RadiotapHeaderTag tag;;
t.GetTag(tag);
extractRadiotapHeaderTag(tag); // Just a function to copy rt headers
break;
}
}