Attach, Detach and Reattch for Wifi

17 views
Skip to first unread message

Arne Boockmeyer

unread,
Aug 6, 2019, 11:27:52 AM8/6/19
to ns-3-users
Hello ns-3-users,

when using a CSMA channel, I can use Attach, Detach and Reattch to connect and disconnect net devices to the network. That works fine. Now I would like to have the same for a Wifi-setup. I'm using the following code:

node_container = ns.network.NodeContainer() # Containing the nodes
position_alloc
= ns.mobility.ListPositionAllocator() # Containing the positions

self.wifi_channel = ns.wifi.YansWifiChannelHelper.Default()
self.wave_phy_helper = ns.wifi.YansWifiPhyHelper.Default()
self.wave_phy_helper.SetChannel(self.wifi_channel.Create())
self.wave_phy_helper.SetPcapDataLinkType(ns.wifi.WifiPhyHelper.DLT_IEEE802_11)
self.wifi80211pMac = ns.wave.NqosWaveMacHelper.Default()
self.wifi80211p = ns.wave.Wifi80211pHelper.Default()

phy_mode
= "OfdmRate6MbpsBW10MHz"
self.wifi80211p.SetRemoteStationManager("ns3::ConstantRateWifiManager",
                                   
"DataMode", ns.core.StringValue(phy_mode),
                                   
"ControlMode", ns.core.StringValue(phy_mode))

devices
= self.wifi80211p.Install(self.wave_phy_helper, self.wifi80211pMac, node_container)
self.wave_phy_helper.EnablePcap("wave-simple-80211p", devices)

self.mobility_helper = ns.mobility.MobilityHelper()
self.mobility_helper.SetMobilityModel("ns3::ConstantPositionMobilityModel")
self.mobility_helper.SetPositionAllocator(position_alloc)
self.mobility_helper.Install(node_container)

Is there a way to have at least the same behaviour? Attach and Reattch for connect and Detach for Disconnect?

Thanks for you help!
Best,
Arne
Reply all
Reply to author
Forward
0 new messages