26#include "ns3/config.h"
27#include "ns3/error-model.h"
29#include "ns3/lte-rlc-header.h"
30#include "ns3/lte-rlc-um.h"
31#include "ns3/net-device-container.h"
32#include "ns3/node-container.h"
33#include "ns3/packet.h"
34#include "ns3/pointer.h"
35#include "ns3/radio-bearer-stats-calculator.h"
36#include "ns3/rng-seed-manager.h"
37#include "ns3/simulator.h"
48 double losses[] = {0.0, 0.05, 0.10, 0.15, 0.25, 0.50, 0.75, 0.90, 0.95};
50 1111, 2222, 3333, 4444, 5555, 6666, 7777, 8888, 9999, 11110,
51 12221, 13332, 14443, 15554, 16665, 17776, 18887, 19998, 21109, 22220,
52 23331, 24442, 25553, 26664, 27775, 28886, 29997, 31108, 32219, 33330,
55 for (
uint32_t l = 0; l < (
sizeof(losses) /
sizeof(
double)); l++)
59 for (
uint32_t sduArrivalType = 0; sduArrivalType <= 1; ++sduArrivalType)
61 std::ostringstream name;
62 name <<
" losses = " << losses[l] * 100 <<
"%; run = " << runs[s];
65 switch (sduArrivalType)
68 bulkSduArrival =
false;
69 name <<
"; continuous SDU arrival";
72 bulkSduArrival =
true;
73 name <<
"; bulk SDU arrival";
113 m_bulkSduArrival(bulkSduArrival),
117 NS_LOG_INFO(
"Creating LteRlcAmTestingTestCase: " + name);
141 uint16_t numberOfNodes = 1;
165 lteSimpleHelper->SetAttribute(
"RlcEntity",
StringValue(
"RlcAm"));
170 enbNodes.
Create(numberOfNodes);
171 ueNodes.
Create(numberOfNodes);
193 dlEm->AssignStreams(3);
195 dlEm->SetAttribute(
"ErrorUnit",
StringValue(
"ERROR_UNIT_PACKET"));
203 ueLteDevs.
Get(0)->SetAttribute(
"ReceiveErrorModel",
PointerValue(dlEm));
204 ueLteDevs.
Get(0)->TraceConnectWithoutContext(
213 double sduStartTimeSeconds = 0.100;
214 double sduStopTimeSeconds;
215 double sduArrivalTimeSeconds;
217 double dlTxOpprTimeSeconds = 0.003;
219 double ulTxOpprTimeSeconds = 0.003;
223 sduStopTimeSeconds = sduStartTimeSeconds + 0.010;
227 sduStopTimeSeconds = sduStartTimeSeconds + 10;
229 sduArrivalTimeSeconds = (sduStopTimeSeconds - sduStartTimeSeconds) / numSdu;
232 lteSimpleHelper->m_enbRrc->SetArrivalTime(
Seconds(sduArrivalTimeSeconds));
233 lteSimpleHelper->m_enbRrc->SetPduSize(sduSizeBytes);
236 lteSimpleHelper->m_enbMac->SetTxOppSize(dlTxOppSizeBytes);
237 lteSimpleHelper->m_enbMac->SetTxOppTime(
Seconds(dlTxOpprTimeSeconds));
241 lteSimpleHelper->m_ueMac->SetTxOppSize(ulTxOppSizeBytes);
242 lteSimpleHelper->m_ueMac->SetTxOppTime(
Seconds(ulTxOpprTimeSeconds));
248 lteSimpleHelper->m_enbRrc);
251 double maxDlThroughput = (dlTxOppSizeBytes / (dlTxOppSizeBytes + 4.0)) *
252 (dlTxOppSizeBytes / dlTxOpprTimeSeconds) * (1.0 -
m_losses);
253 const double statusProhibitSeconds = 0.020;
254 double pollFrequency = (1.0 / dlTxOpprTimeSeconds) * (1 -
m_losses);
255 double statusFrequency = std::min(pollFrequency, 1.0 / statusProhibitSeconds);
256 const uint32_t numNackSnPerStatusPdu = (ulTxOppSizeBytes * 8 - 14) / 10;
257 double maxRetxThroughput =
258 ((
double)numNackSnPerStatusPdu * (
double)dlTxOppSizeBytes) * statusFrequency;
259 double throughput = std::min(maxDlThroughput, maxRetxThroughput);
261 ((sduSizeBytes) * (sduStopTimeSeconds - sduStartTimeSeconds) / sduArrivalTimeSeconds);
306 Seconds(std::max(sduStartTimeSeconds + totBytes /
throughput, sduStopTimeSeconds)) + margin;
308 NS_LOG_INFO(
"statusFrequency=" << statusFrequency <<
", maxDlThroughput=" << maxDlThroughput
309 <<
", maxRetxThroughput=" << maxRetxThroughput <<
", totBytes="
315 uint32_t txEnbRrcPdus = lteSimpleHelper->m_enbRrc->GetTxPdus();
316 uint32_t rxUeRrcPdus = lteSimpleHelper->m_ueRrc->GetRxPdus();
318 uint32_t txEnbRlcPdus = lteSimpleHelper->m_enbMac->GetTxPdus();
319 uint32_t rxUeRlcPdus = lteSimpleHelper->m_ueMac->GetRxPdus();
324 NS_LOG_INFO(
"RLC PDUs TX: " << txEnbRlcPdus <<
" RX: " << rxUeRlcPdus
326 << (100.0 * (
double)
m_dlDrops) / txEnbRlcPdus <<
"%)");
330 "lost RLC PDUs don't match TX + RX");
332 NS_LOG_INFO(
"eNB tx RRC count = " << txEnbRrcPdus);
337 "TX PDUs (" << txEnbRrcPdus <<
") != RX PDUs (" << rxUeRrcPdus <<
")");
Test cases used for the test suite lte-rlc-am-e2e.
void DlDropEvent(Ptr< const Packet > p)
DL drop event.
uint32_t m_ulDrops
number of UL drops
~LteRlcAmE2eTestCase() override
bool m_bulkSduArrival
bulk SDU arrival
void DoRun() override
Implementation to actually run this TestCase.
void UlDropEvent(Ptr< const Packet > p)
UL drop event.
uint32_t m_dlDrops
number of Dl drops
double m_losses
error rate
Test suite for RlcAmE2e test case.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void Stop()
Stop function.
void Start()
Start function.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
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.
Hold objects of type Ptr<T>.
Smart pointer class similar to boost::intrusive_ptr.
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 void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Hold variables of type string.
TestDuration
How long the test takes to execute.
@ EXTENSIVE
Medium length test.
@ TAKES_FOREVER
Very long running test.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
AttributeValue implementation for Time.
Hold an unsigned integer type.
void SetGlobal(std::string name, const AttributeValue &value)
void SetDefault(std::string name, const AttributeValue &value)
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
static LteRlcAmE2eTestSuite lteRlcAmE2eTestSuite
Static variable for test initialization.
#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.
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.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...