23 #include "ns3/rng-seed-manager.h" 24 #include "ns3/config.h" 25 #include "ns3/data-rate.h" 26 #include "ns3/vector.h" 27 #include "ns3/string.h" 28 #include "ns3/packet-socket-address.h" 29 #include "ns3/mobility-model.h" 30 #include "ns3/yans-wifi-helper.h" 31 #include "ns3/position-allocator.h" 32 #include "ns3/packet-socket-helper.h" 33 #include "ns3/mobility-helper.h" 34 #include "ns3/wifi-net-device.h" 35 #include "ns3/packet-socket-server.h" 36 #include "ns3/packet-socket-client.h" 37 #include "ns3/ocb-wifi-mac.h" 38 #include "ns3/wifi-80211p-helper.h" 39 #include "ns3/wave-mac-helper.h" 47 int64_t currentStream = stream;
86 virtual void DoRun (
void);
117 Vector GetCurrentPosition (uint32_t i);
125 void PreRandomConfiguration (
void);
166 :
TestCase (
"Association time: Ap+Sta mode vs Adhoc mode vs Ocb mode")
180 Vector pos =
mobility->GetPosition ();
200 Vector pos =
mobility->GetPosition ();
263 wifi.SetRemoteStationManager (
"ns3::ConstantRateWifiManager",
265 "ControlMode",
StringValue (
"OfdmRate6MbpsBW10MHz"));
266 wifi.Install (wifiPhy, wifiStaMac, mobile_node);
267 wifi.Install (wifiPhy, wifiApMac, static_node);
278 wifiMac.
SetType (
"ns3::AdhocWifiMac");
282 wifi.SetRemoteStationManager (
"ns3::ConstantRateWifiManager",
284 "ControlMode",
StringValue (
"OfdmRate6MbpsBW10MHz"));
285 wifi.Install (wifiPhy, wifiMac, mobile_node);
286 wifi.Install (wifiPhy, wifiMac, static_node);
301 "ControlMode",
StringValue (
"OfdmRate6MbpsBW10MHz"));
302 wifi80211p.
Install (wifiPhy, wifi80211pMac, mobile_node);
303 wifi80211p.
Install (wifiPhy, wifi80211pMac, static_node);
338 packetSocket.
Install (static_node);
339 packetSocket.
Install (mobile_node);
377 std::cout <<
"test time point for Ap-Sta mode" << std::endl;
385 Simulator::Stop (
Seconds (71.0));
387 Simulator::Destroy ();
397 std::cout <<
"test time point for Adhoc mode" << std::endl;
405 Simulator::Stop (
Seconds (71.0));
407 Simulator::Destroy ();
417 std::cout <<
"test time point for Ocb mode" << std::endl;
425 Simulator::Stop (
Seconds (71.0));
427 Simulator::Destroy ();
438 RngSeedManager::SetSeed (1);
439 RngSeedManager::SetRun (17);
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
helps to create wifi 802.11p objects of WifiNetDevice class
void SetStopTime(Time stop)
Specify application stop time.
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
static void AdvancePosition(Ptr< Node > node)
void MacAssoc(std::string context, Mac48Address bssid)
MAC associate function.
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Hold variables of type string.
Make it easy to create and manage PHY objects for the yans model.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
an address for a packet socket
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
void ConfigureOcbMode(Ptr< Node > static_node, Ptr< Node > mobile_node)
Configure OCB mode function.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
static OcbTestSuite ocbTestSuite
the test suite
void PhyTxTrace(std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
Phy transmit trace function.
helps to create WifiNetDevice objects
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Give ns3::PacketSocket powers to ns3::Node.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Address GetAddress(void) const
Ptr< YansWifiChannel > Create(void) const
Vector macassoc_pos
MAC associate position.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Keep track of the current position and velocity of an object.
void SetChannel(Ptr< YansWifiChannel > channel)
Time phyrx_time
Phy receive time.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
virtual ~OcbWifiMacTestCase(void)
Vector GetCurrentPosition(uint32_t i)
Get current position function.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void PhyRxOkTrace(std::string context, Ptr< const Packet > packet, double snr, WifiMode mode, WifiPreamble preamble)
void PhyRxOkTrace(std::string context, Ptr< const Packet > packet, double snr, WifiMode mode, enum WifiPreamble preamble)
Phy receive ok trace function.
void Connect(std::string path, const CallbackBase &cb)
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void AdvancePosition(Ptr< Node > node)
Advance position function.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetPhysicalAddress(const Address address)
Set the destination address.
keep track of a set of node pointers.
Hold objects of type Ptr<T>.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void PhyTxTrace(std::string context, Ptr< const Packet > packet, WifiMode mode, WifiPreamble preamble, uint8_t txPower)
void PostDeviceConfiguration(Ptr< Node > static_node, Ptr< Node > mobile_node)
Post device configuration function.
virtual void DoRun(void)
static-node:0 <-— mobile-node:1
manage and create wifi channel objects for the yans model.
create MAC layers for a ns3::WifiNetDevice.
Nqos Wave Mac Helper class.
Time phytx_time
Phy transmit time.
void SetPosition(const Vector &position)
The IEEE 802.11 SSID Information Element.
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
static void AssignWifiRandomStreams(Ptr< WifiMac > mac, int64_t stream)
Vector GetPosition(void) const
Helper class used to assign positions and mobility models to nodes.
void ConfigureApStaMode(Ptr< Node > static_node, Ptr< Node > mobile_node)
Configure AP STA mode function.
Ptr< WifiMac > GetMac(void) const
Vector phytx_pos
Phy transmit position.
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &macHelper, NodeContainer c) const
Time Seconds(double value)
Construct a Time in the indicated unit.
AttributeValue implementation for Ssid.
void SetProtocol(uint16_t protocol)
Set the protocol.
NodeContainer nodes
the nodes
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Vector phyrx_pos
Phy receive position.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void PreRandomConfiguration(void)
Pre random configuration function.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
void ConfigureAdhocMode(Ptr< Node > static_node, Ptr< Node > mobile_node)
Configure adhoc mode function.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
void SetStartTime(Time start)
Specify application start time.
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
Time macassoc_time
MAC associate time.
Handle packet fragmentation and retransmissions for data and management frames.