21#include "ns3/ap-wifi-mac.h"
22#include "ns3/boolean.h"
23#include "ns3/config.h"
24#include "ns3/internet-stack-helper.h"
25#include "ns3/ipv4-address-helper.h"
26#include "ns3/mobility-helper.h"
27#include "ns3/multi-model-spectrum-channel.h"
28#include "ns3/packet.h"
29#include "ns3/qos-utils.h"
30#include "ns3/queue-size.h"
31#include "ns3/rng-seed-manager.h"
32#include "ns3/spectrum-wifi-helper.h"
33#include "ns3/string.h"
35#include "ns3/udp-client-server-helper.h"
36#include "ns3/wifi-net-device.h"
66 void DoRun()
override;
82 :
TestCase(
"Test case for resuming data transmission when the recipient moves back"),
84 m_lastCheckPointTime(
Seconds(0)),
113 int64_t streamNumber = 100;
116 wifiApNode.Create(1);
123 spectrumChannel->AddPropagationLossModel(lossModel);
125 CreateObject<ConstantSpeedPropagationDelayModel>();
126 spectrumChannel->SetPropagationDelayModel(delayModel);
129 phy.SetChannel(spectrumChannel);
133 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
142 mac.SetType(
"ns3::StaWifiMac",
"Ssid",
SsidValue(
Ssid(
"issue211-test")));
146 mac.SetType(
"ns3::ApWifiMac",
149 "EnableBeaconJitter",
155 wifi.AssignStreams(apDevices, streamNumber);
160 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
161 positionAlloc->Add(Vector(5.0, 0.0, 0.0));
162 mobility.SetPositionAllocator(positionAlloc);
164 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
165 mobility.Install(wifiApNode);
166 mobility.Install(wifiStaNode);
170 stack.Install(wifiApNode);
171 stack.Install(wifiStaNode);
174 address.SetBase(
"192.168.1.0",
"255.255.255.0");
178 staNodeInterface = address.Assign(staDevices.Get(0));
179 apNodeInterface = address.Assign(apDevices.Get(0));
186 serverApp = server.Install(wifiStaNode.
Get(0));
188 serverApp.
Stop(warmup + simulationTime);
191 client.SetAttribute(
"MaxPackets",
UintegerValue(4294967295U));
195 clientApp.
Start(warmup);
196 clientApp.
Stop(warmup + simulationTime);
204 Vector(10000.0, 0.0, 0.0));
208 DynamicCast<UdpServer>(serverApp.
Get(0)));
214 Vector(5.0, 0.0, 0.0));
218 DynamicCast<UdpServer>(serverApp.
Get(0)));
224 DynamicCast<UdpServer>(serverApp.
Get(0)));
232 "Throughput must be non null before station moves away");
236 "Throughput must be non null when the station is back");
241 std::cout <<
"Throughput = " << t <<
" Mb/s" << std::endl;
Test for issue 211 (https://gitlab.com/nsnam/ns-3-dev/-/issues/211)
std::vector< double > m_tputValues
throughput in sub-intervals
Time m_lastCheckPointTime
time of last check-point
Issue211Test()
Constructor.
uint32_t m_payloadSize
payload size in bytes
void DoRun() override
Implementation to actually run this TestCase.
uint64_t m_lastRxBytes
RX bytes at last check-point.
void CalcThroughput(Ptr< UdpServer > server)
Compute the average throughput since the last check-point.
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter.
AttributeValue implementation for Boolean.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
void SetPosition(const Vector &position)
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
Class for representing queue sizes.
AttributeValue implementation for QueueSize.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
Hold variables of type string.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
AttributeValue implementation for Time.
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
Create a server application which waits for input UDP packets and uses the information carried into t...
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetDefault(std::string name, const AttributeValue &value)
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static Issue211TestSuite g_issue211TestSuite
the test suite