|
Bugzilla – Full Text Bug Listing |
| Summary: | How to add basic rates to 802.11 | ||
|---|---|---|---|
| Product: | ns-3 | Reporter: | Rober <sanzrober> |
| Component: | wifi | Assignee: | Nicola Baldo <nicola> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | deanarm, nikkipui, ns-bugs, pvnskbs, ruben |
| Priority: | P5 | ||
| Version: | pre-release | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | Capture sample with PHY header showing beacons @11Mbps and ACKs @1Mbps | ||
|
Description
Rober
2011-06-06 09:29:10 UTC
This is how I have modified the basic rate set (where apDev is a NetDeviceContainer containing (as the first device) a Wi-Fi AP)...
// Add the DSSS/CCK rates as the basic rates of our AP
Ptr<WifiRemoteStationManager> apStationManager = DynamicCast<WifiNetDevice>(apDev.Get (0))->GetRemoteStationManager ();
apStationManager->AddBasicMode (WifiMode ("DsssRate1Mbps"));
apStationManager->AddBasicMode (WifiMode ("DsssRate2Mbps"));
apStationManager->AddBasicMode (WifiMode ("DsssRate5_5Mbps"));
apStationManager->AddBasicMode (WifiMode ("DsssRate11Mbps"));
It works, but is a little obscure - I guess one could construct an API to allow this to be modified through the Attributes subsystem.
Does this help you?
(In reply to comment #1) > This is how I have modified the basic rate set (where apDev is a > NetDeviceContainer containing (as the first device) a Wi-Fi AP)... > > // Add the DSSS/CCK rates as the basic rates of our AP > Ptr<WifiRemoteStationManager> apStationManager = > DynamicCast<WifiNetDevice>(apDev.Get (0))->GetRemoteStationManager (); > apStationManager->AddBasicMode (WifiMode ("DsssRate1Mbps")); > apStationManager->AddBasicMode (WifiMode ("DsssRate2Mbps")); > apStationManager->AddBasicMode (WifiMode ("DsssRate5_5Mbps")); > apStationManager->AddBasicMode (WifiMode ("DsssRate11Mbps")); > > It works, but is a little obscure - I guess one could construct an API to allow > this to be modified through the Attributes subsystem. > > Does this help you? Yes, it works out! Thanks a lot. Now I can control the rate for ACKs and the rate for data frames in a separate way, just to achieve a behaviour like in real tests with real cards. But... I also have tried your modification for a IBSS network (i.e. ad hoc mode) but it seems that basic rates can't be modified with the same code (obviously I have changed apDev for staDevs. Maybe you can tell me a way to adapt the BSS modification to the IBSS case. Thanks again! (In reply to comment #2) > But... I also have tried your modification for a IBSS network (i.e. ad hoc > mode) but it seems that basic rates can't be modified with the same code > (obviously I have changed apDev for staDevs. Maybe you can tell me a way to > adapt the BSS modification to the IBSS case. I haven't tried it, but I would have thought it would work if you did it for each STA in the IBSS - i.e., the code I provided could be repeated in a for loop across the STAs in your staDevs. Perhaps something like this... // Add the DSSS/CCK rates as the basic rates of each STA for (uint16_t i = 0; i < nStas; i++) { Ptr<WifiRemoteStationManager> nodeStationManager = DynamicCast<WifiNetDevice>(staDevs.Get (i))->GetRemoteStationManager (); nodeStationManager->AddBasicMode (WifiMode ("DsssRate1Mbps")); nodeStationManager->AddBasicMode (WifiMode ("DsssRate2Mbps")); nodeStationManager->AddBasicMode (WifiMode ("DsssRate5_5Mbps")); nodeStationManager->AddBasicMode (WifiMode ("DsssRate11Mbps")); } I haven't worked with the ns-3 "IBSS" much though, so I might be off-base. (In reply to comment #3) > (In reply to comment #2) > > But... I also have tried your modification for a IBSS network (i.e. ad hoc > > mode) but it seems that basic rates can't be modified with the same code > > (obviously I have changed apDev for staDevs. Maybe you can tell me a way to > > adapt the BSS modification to the IBSS case. > > I haven't tried it, but I would have thought it would work if you did it for > each STA in the IBSS - i.e., the code I provided could be repeated in a for > loop across the STAs in your staDevs. Perhaps something like this... > > // Add the DSSS/CCK rates as the basic rates of each STA > for (uint16_t i = 0; i < nStas; i++) { > Ptr<WifiRemoteStationManager> nodeStationManager = > DynamicCast<WifiNetDevice>(staDevs.Get (i))->GetRemoteStationManager (); > nodeStationManager->AddBasicMode (WifiMode ("DsssRate1Mbps")); > nodeStationManager->AddBasicMode (WifiMode ("DsssRate2Mbps")); > nodeStationManager->AddBasicMode (WifiMode ("DsssRate5_5Mbps")); > nodeStationManager->AddBasicMode (WifiMode ("DsssRate11Mbps")); > } > > I haven't worked with the ns-3 "IBSS" much though, so I might be off-base. Thank you for your soon reply. I've already tried exactly the same code that you suggest for the IBSS case. It compiles ok, but it fails when is executed. I've been doing some tries and the failing line of code is the pointer definition: Ptr<WifiRemoteStationManager> nodeStationManager = DynamicCast<WifiNetDevice>(staDevs.Get (i))->GetRemoteStationManager (); I must confess that I haven't neither worked win IBSS much, but I guessed it would be applied in the same way as for the BSS mode. Any help will be welcome. Thanks! (In reply to comment #4) > Thank you for your soon reply. I've already tried exactly the same code that > you suggest for the IBSS case. It compiles ok, but it fails when is executed. > I've been doing some tries and the failing line of code is the pointer > definition: > > Ptr<WifiRemoteStationManager> nodeStationManager = > DynamicCast<WifiNetDevice>(staDevs.Get (i))->GetRemoteStationManager (); I've just tried doing what you want to do (modify basic rate set in an ns-3 simulation with AdhocWifiMac devices) using the code I quoted in my previous comment, and it works for me. You might need to share a bit more of your code (preferably a minimal failing example) for me to be able to help you. This thread of discussion also leaves me wondering where this bug now stands. (In reply to comment #5) > (In reply to comment #4) > > Thank you for your soon reply. I've already tried exactly the same code that > > you suggest for the IBSS case. It compiles ok, but it fails when is executed. > > I've been doing some tries and the failing line of code is the pointer > > definition: > > > > Ptr<WifiRemoteStationManager> nodeStationManager = > > DynamicCast<WifiNetDevice>(staDevs.Get (i))->GetRemoteStationManager (); > > I've just tried doing what you want to do (modify basic rate set in an ns-3 > simulation with AdhocWifiMac devices) using the code I quoted in my previous > comment, and it works for me. > > You might need to share a bit more of your code (preferably a minimal failing > example) for me to be able to help you. > > This thread of discussion also leaves me wondering where this bug now stands. Sorry, you're right. It was my silly fault. I typed "<=" instead of "<" inside the "for" loop, so it overflowed the number of STA's. So, it also works fine for me, and this bug may be closed. The only doubt that remains is the actual function of the parameter "ControlMode" like in: wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode",StringValue(phyMode), "ControlMode",StringValue("DsssRate5_5Mbps")); Isn't it supposed that "ControlMode" acts on the rate of control and management frames? But indeed it doesn't. Well, this is just my last thought about all this issue. Thanks for all! (In reply to comment #6) > The only doubt that remains is the actual function of the parameter > "ControlMode" like in: > > wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", > "DataMode",StringValue(phyMode), > "ControlMode",StringValue("DsssRate5_5Mbps")); > > Isn't it supposed that "ControlMode" acts on the rate of control and management > frames? But indeed it doesn't. Despite the attribute naming and the associated comment, as far as I can tell this attribute does not act on anything other than RTS frames. As you appear to know, the standard is quite clear on the rules for selection of transmission parameters for control response frames (i.e., frames of type control that are sent after SIFS). These rules are built into the implementation of WifiRemoteStationManager and are not overridden/broken in the derived ConstantRateWifiManager. Nicola - as maintainer, do you think there is any API or documentation that particularly needs updating as a result of the discussion in this bug, or should it be closed as "invalid"? (In reply to comment #7) > (In reply to comment #6) > > The only doubt that remains is the actual function of the parameter > > "ControlMode" like in: > > > > wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", > > "DataMode",StringValue(phyMode), > > "ControlMode",StringValue("DsssRate5_5Mbps")); > > > > Isn't it supposed that "ControlMode" acts on the rate of control and management > > frames? But indeed it doesn't. > > Despite the attribute naming and the associated comment, as far as I can tell > this attribute does not act on anything other than RTS frames. > > As you appear to know, the standard is quite clear on the rules for selection > of transmission parameters for control response frames (i.e., frames of type > control that are sent after SIFS). These rules are built into the > implementation of WifiRemoteStationManager and are not overridden/broken in the > derived ConstantRateWifiManager. > > Nicola - as maintainer, do you think there is any API or documentation that > particularly needs updating as a result of the discussion in this bug, or > should it be closed as "invalid"? Hi Folks, I don't think this bug should be classified as invalid. While I agree that the standard is quite clear, there is also evidence that several 802.11 drivers (typically atheros drivers) allow you to change the rate of all control packets. So I believe that ns-3 should also support this. Now, I think Dean's recipe could simply be documented on the wiki as a HOWTO. (In reply to comment #8) > (In reply to comment #7) > > (In reply to comment #6) > > > The only doubt that remains is the actual function of the parameter > > > "ControlMode" like in: > > > > > > wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", > > > "DataMode",StringValue(phyMode), > > > "ControlMode",StringValue("DsssRate5_5Mbps")); > > > > > > Isn't it supposed that "ControlMode" acts on the rate of control and management > > > frames? But indeed it doesn't. > > > > Despite the attribute naming and the associated comment, as far as I can tell > > this attribute does not act on anything other than RTS frames. > > > > As you appear to know, the standard is quite clear on the rules for selection > > of transmission parameters for control response frames (i.e., frames of type > > control that are sent after SIFS). These rules are built into the > > implementation of WifiRemoteStationManager and are not overridden/broken in the > > derived ConstantRateWifiManager. > > > > Nicola - as maintainer, do you think there is any API or documentation that > > particularly needs updating as a result of the discussion in this bug, or > > should it be closed as "invalid"? > > Hi Folks, > > I don't think this bug should be classified as invalid. While I agree that the > standard is quite clear, there is also evidence that several 802.11 drivers > (typically atheros drivers) allow you to change the rate of all control > packets. So I believe that ns-3 should also support this. Now, I think Dean's > recipe could simply be documented on the wiki as a HOWTO. I fully agree with you, Ruben. You suppose right, I'm using Atheros chipset cards with Madwifi driver, and these cards always use the highest rates possible to achieve the greatest throughput for the user. Thus, it's ok for me to move this recipe to the wiki. Bye HOWTO created in ns-3 wiki. |