29 ns.core.CommandLine().Parse(argv)
36 ns.core.GlobalValue.Bind(
"SimulatorImplementationType", ns.core.StringValue(
"ns3::RealtimeSimulatorImpl"))
37 ns.core.GlobalValue.Bind(
"ChecksumEnabled", ns.core.BooleanValue(
"true"))
44 nodes = ns.network.NodeContainer()
50 wifi = ns.wifi.WifiHelper()
51 wifi.SetStandard (ns.wifi.WIFI_STANDARD_80211a);
52 wifi.SetRemoteStationManager (
"ns3::ConstantRateWifiManager",
"DataMode", ns.core.StringValue (
"OfdmRate54Mbps"));
57 wifiMac = ns.wifi.WifiMacHelper()
58 wifiMac.SetType (
"ns3::AdhocWifiMac");
63 wifiChannel = ns.wifi.YansWifiChannelHelper.Default()
64 wifiPhy = ns.wifi.YansWifiPhyHelper()
65 wifiPhy.SetChannel(wifiChannel.Create())
70 devices = wifi.Install(wifiPhy, wifiMac, nodes)
76 mobility = ns.mobility.MobilityHelper()
77 positionAlloc = ns.mobility.ListPositionAllocator()
78 positionAlloc.Add(ns.core.Vector(0.0, 0.0, 0.0))
79 positionAlloc.Add(ns.core.Vector(5.0, 0.0, 0.0))
80 mobility.SetPositionAllocator(positionAlloc)
81 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel")
82 mobility.Install(nodes)
92 tapBridge = ns.tap_bridge.TapBridgeHelper()
93 tapBridge.SetAttribute (
"Mode", ns.core.StringValue (
"UseLocal"));
94 tapBridge.SetAttribute (
"DeviceName", ns.core.StringValue (
"tap-left"));
95 tapBridge.Install (nodes.Get (0), devices.Get (0));
101 tapBridge.SetAttribute (
"DeviceName", ns.core.StringValue (
"tap-right"));
102 tapBridge.Install (nodes.Get (1), devices.Get (1));
107 ns.core.Simulator.Stop (ns.core.Seconds (600));
108 ns.core.Simulator.Run(signal_check_frequency = -1)
109 ns.core.Simulator.Destroy()
112 if __name__ ==
'__main__':
113 sys.exit(main(sys.argv))