22 #include "ns3/config.h"
23 #include "ns3/simulator.h"
24 #include "ns3/pointer.h"
26 #include "ns3/packet.h"
27 #include "ns3/node-container.h"
28 #include "ns3/net-device-container.h"
29 #include "ns3/error-model.h"
30 #include "ns3/rng-seed-manager.h"
31 #include "ns3/radio-bearer-stats-calculator.h"
32 #include "ns3/lte-rlc-header.h"
33 #include "ns3/lte-rlc-um.h"
34 #include "ns3/config-store.h"
50 double losses[] = {0.0, 0.05, 0.10, 0.15, 0.25, 0.50, 0.75, 0.90, 0.95};
51 uint32_t runs[] = {1111, 2222, 3333, 4444, 5555, 6666, 7777, 8888, 9999, 11110,
52 12221, 13332, 14443, 15554, 16665, 17776, 18887, 19998, 21109, 22220,
53 23331, 24442, 25553, 26664, 27775, 28886, 29997, 31108, 32219, 33330};
55 for ( uint32_t l = 0 ; l < (
sizeof (losses) /
sizeof (
double)) ; l++ )
57 for ( uint32_t s = 0 ; s < (
sizeof (runs) /
sizeof (uint32_t)) ; s++ )
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";
83 testDuration = TestCase::QUICK;
87 testDuration = TestCase::EXTENSIVE;
91 testDuration = TestCase::TAKES_FOREVER;
105 m_bulkSduArrival (bulkSduArrival),
109 NS_LOG_INFO (
"Creating LteRlcAmTestingTestCase: " + name);
134 uint16_t numberOfNodes = 1;
163 enbNodes.
Create (numberOfNodes);
164 ueNodes.
Create (numberOfNodes);
194 ueLteDevs.
Get (0)->SetAttribute (
"ReceiveErrorModel",
PointerValue (dlEm));
201 uint32_t sduSizeBytes = 100;
202 uint32_t numSdu = 1000;
203 double sduStartTimeSeconds = 0.100;
204 double sduStopTimeSeconds;
205 double sduArrivalTimeSeconds;
206 uint32_t dlTxOppSizeBytes = 150;
207 double dlTxOpprTimeSeconds = 0.003;
208 uint32_t ulTxOppSizeBytes = 140;
209 double ulTxOpprTimeSeconds = 0.003;
213 sduStopTimeSeconds = sduStartTimeSeconds + 0.010;
217 sduStopTimeSeconds = sduStartTimeSeconds + 10;
219 sduArrivalTimeSeconds = (sduStopTimeSeconds - sduStartTimeSeconds) / numSdu;
224 lteSimpleHelper->
m_enbRrc->SetArrivalTime (
Seconds (sduArrivalTimeSeconds));
225 lteSimpleHelper->
m_enbRrc->SetPduSize (sduSizeBytes);
238 Simulator::Schedule (
Seconds (sduStartTimeSeconds), &LteTestRrc::Start, lteSimpleHelper->
m_enbRrc);
239 Simulator::Schedule (
Seconds (sduStopTimeSeconds), &LteTestRrc::Stop, lteSimpleHelper->
m_enbRrc);
242 double maxDlThroughput = (dlTxOppSizeBytes/(dlTxOppSizeBytes+4.0))*(dlTxOppSizeBytes/dlTxOpprTimeSeconds) * (1.0-
m_losses);
243 const double statusProhibitSeconds = 0.020;
244 double pollFrequency = (1.0/dlTxOpprTimeSeconds)*(1-
m_losses);
245 double statusFrequency = std::min (pollFrequency, 1.0/statusProhibitSeconds);
246 const uint32_t numNackSnPerStatusPdu = (ulTxOppSizeBytes*8 - 14)/10;
247 double maxRetxThroughput = ((double)numNackSnPerStatusPdu*(
double)dlTxOppSizeBytes)*statusFrequency;
248 double throughput = std::min (maxDlThroughput, maxRetxThroughput);
249 double totBytes = ((sduSizeBytes) * (sduStopTimeSeconds - sduStartTimeSeconds) / sduArrivalTimeSeconds);
294 Time stopTime =
Seconds (std::max (sduStartTimeSeconds + totBytes/throughput, sduStopTimeSeconds)) + margin;
296 NS_LOG_INFO (
"statusFrequency=" << statusFrequency <<
", maxDlThroughput=" << maxDlThroughput <<
", maxRetxThroughput=" << maxRetxThroughput <<
", totBytes=" << totBytes <<
", stopTime=" << stopTime.
GetSeconds () <<
"s");
298 Simulator::Stop (stopTime);
301 uint32_t txEnbRrcPdus = lteSimpleHelper->
m_enbRrc->GetTxPdus ();
302 uint32_t rxUeRrcPdus = lteSimpleHelper->
m_ueRrc->GetRxPdus ();
312 <<
" RX: " << rxUeRlcPdus
314 <<
" (" << (100.0 * (
double)
m_dlDrops)/txEnbRlcPdus <<
"%)");
318 NS_LOG_INFO (
"eNB tx RRC count = " << txEnbRrcPdus);
323 "TX PDUs (" << txEnbRrcPdus <<
") != RX PDUs (" << rxUeRrcPdus <<
")");
325 Simulator::Destroy ();
Ptr< LteTestRrc > m_enbRrc
Simulation virtual time values and global simulation resolution.
Hold variables of type string.
Provides the test suite lte-rlc-am-e2e.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Hold a signed integer type.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Ptr< LteTestRrc > m_ueRrc
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_FATAL_ERROR(msg)
Fatal error handling.
void SetTxOpportunityMode(uint8_t mode)
Ptr< LteTestMac > m_ueMac
Test cases used for the test suite lte-rlc-am-e2e.
TestDuration
How long the test takes to execute.
Ptr< LteTestMac > m_enbMac
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
AttributeValue implementation for Time.
virtual ~LteRlcAmE2eTestCase()
#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.
holds a vector of ns3::NetDevice pointers
NetDeviceContainer InstallEnbDevice(NodeContainer c)
create a set of eNB devices
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void SetTxOppTime(Time txOppTime)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Hold objects of type Ptr.
NetDeviceContainer InstallUeDevice(NodeContainer c)
create a set of UE devices
static LteRlcAmE2eTestSuite lteRlcAmE2eTestSuite
void SetTxOppSize(uint32_t txOppSize)
void SetGlobal(std::string name, const AttributeValue &value)
virtual void DoRun(void)
Implementation to actually run this TestCase.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
void DlDropEvent(Ptr< const Packet > p)
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void UlDropEvent(Ptr< const Packet > p)