|
Bugzilla – Full Text Bug Listing |
| Summary: | ns3::YansWifiPhy::EnergyDetectionThreshold Initial values do not correspond docs | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Laurynas Riliskis <laurynas.riliskis> |
| Component: | wifi | Assignee: | Mathieu Lacage <mathieu.lacage> |
| Status: | RESOLVED WORKSFORME | ||
| Severity: | major | CC: | nicola, ns-bugs, quincy.tse |
| Priority: | P5 | ||
| Version: | ns-3.6 | ||
| Hardware: | All | ||
| OS: | All | ||
Works under 3.7.1 - should this be closed? I tried the supplied test program with ns-3-dev 6188, and it behaves correctly. Closing the bug. |
I have been testing retrieving Initial values of the Attributes and it seems that the documentation and the actual set values do not match. ns3::YansWifiPhy::EnergyDetectionThreshold - INIT: -140 The energy of a received signal should be higher than this threshold (dbm) to allow the PHY layer to detect the signal. The retrieved values is -140, but the documented values is "Initial value: -96" The rest seems to be ok, besides that it does not print all values. #include "ns3/core-module.h" #include "ns3/common-module.h" #include "ns3/node-module.h" #include "ns3/helper-module.h" #include "ns3/mobility-module.h" #include "ns3/contrib-module.h" #include "ns3/wifi-module.h" #include "ns3/athstats-helper.h" #include <iostream> using namespace ns3; using namespace std; int main (int argc, char *argv[]) { // enable rts cts all the time. Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold", StringValue ("0")); // disable fragmentation Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2200")); WifiHelper wifi = WifiHelper::Default (); MobilityHelper mobility; NodeContainer stas; NodeContainer ap; NetDeviceContainer staDevs; PacketSocketHelper packetSocket; stas.Create (2); ap.Create (1); // give packet socket powers to nodes. packetSocket.Install (stas); packetSocket.Install (ap); NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default (); wifiPhy.SetChannel (wifiChannel.Create ()); Ssid ssid = Ssid ("wifi-default"); wifi.SetRemoteStationManager ("ns3::ArfWifiManager"); // setup stas. wifiMac.SetType ("ns3::NqstaWifiMac", "Ssid", SsidValue (ssid), "ActiveProbing", BooleanValue (false)); staDevs = wifi.Install (wifiPhy, wifiMac, stas); // setup ap. wifiMac.SetType ("ns3::NqapWifiMac", "Ssid", SsidValue (ssid), "BeaconGeneration", BooleanValue (true), "BeaconInterval", TimeValue (Seconds (2.5))); wifi.Install (wifiPhy, wifiMac, ap); // mobility. mobility.Install (stas); mobility.Install (ap); PacketSocketAddress socket; socket.SetSingleDevice(staDevs.Get (0)->GetIfIndex ()); socket.SetPhysicalAddress (staDevs.Get (1)->GetAddress ()); socket.SetProtocol (1); OnOffHelper onoff ("ns3::PacketSocketFactory", Address (socket)); onoff.SetAttribute ("OnTime", RandomVariableValue (ConstantVariable (42))); onoff.SetAttribute ("OffTime", RandomVariableValue (ConstantVariable (0))); ApplicationContainer apps = onoff.Install (stas.Get (0)); apps.Start (Seconds (0.5)); apps.Stop (Seconds (0.6); Simulator::Stop (Seconds (1.0)); TypeId tid = YansWifiPhy::GetTypeId(); cout << endl << "Attributes for Sender:" << endl; uint32_t tidn = tid.GetAttributeN(); /** * A bit tricy to get initial value * tid.GetAttributeInitialValue(tidcount) returns Ptr< const AttributeValue > * To get string we need checker * ->SerializeToString(tid.GetAttributeChecker(tidcount)) * Don't understand why its so complicated.... */ for (uint32_t tidcount = 0; tidcount < tidn; tidcount++) { cout << " " << tid.GetAttributeFullName(tidcount) << " - " << " INIT: " << tid.GetAttributeInitialValue(tidcount)- >SerializeToString(tid.GetAttributeChecker(tidcount))<< " "<< tid.GetAttributeHelp(tidcount) << endl; } //Docs needs to be checked what associated object has traces cout << endl << "Trace Sources for WifiPhy:" << endl; TypeId tid1 = WifiPhy::GetTypeId(); uint32_t tidn1 = tid1.GetTraceSourceN(); for (uint32_t tidcount = 0; tidcount < tidn1; tidcount++) { cout << " " << tid1.GetTraceSourceName(tidcount) << " - " << tid1.GetTraceSourceHelp(tidcount) << endl; } cout << endl; Simulator::Run (); Simulator::Destroy (); return 0;