27 #include <ns3/application-container.h> 28 #include <ns3/friis-spectrum-propagation-loss.h> 29 #include <ns3/internet-stack-helper.h> 30 #include <ns3/ipv4-address-helper.h> 31 #include <ns3/ipv4-interface-container.h> 32 #include <ns3/ipv4-static-routing-helper.h> 34 #include <ns3/lte-enb-net-device.h> 35 #include <ns3/lte-helper.h> 36 #include <ns3/lte-ue-net-device.h> 37 #include <ns3/lte-ue-rrc.h> 38 #include <ns3/mobility-helper.h> 39 #include <ns3/net-device-container.h> 40 #include <ns3/node-container.h> 41 #include <ns3/packet-sink.h> 42 #include <ns3/point-to-point-epc-helper.h> 43 #include <ns3/point-to-point-helper.h> 44 #include <ns3/simulator.h> 45 #include <ns3/udp-client.h> 52 :
TestSuite (
"lte-aggregation-throughput-scale", SYSTEM)
82 auto lteHelper = CreateObject<LteHelper> ();
84 lteHelper->SetAttribute (
"NumberOfComponentCarriers",
UintegerValue (numberOfComponentCarriers));
85 lteHelper->SetAttribute (
"EnbComponentCarrierManager",
StringValue (
"ns3::RrComponentCarrierManager"));
87 auto epcHelper = CreateObject<PointToPointEpcHelper> ();
88 lteHelper->SetEpcHelper (epcHelper);
90 auto enbNode = CreateObject<Node> ();
91 auto ueNode = CreateObject<Node> ();
92 auto pgwNode = epcHelper->GetPgwNode ();
95 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
103 ipv4h.
SetBase (
"1.0.0.0",
"255.0.0.0");
107 ueStaticRouting->SetDefaultRoute (epcHelper->GetUeDefaultGatewayAddress (), 1);
109 auto enbDev = DynamicCast<LteEnbNetDevice> (lteHelper->InstallEnbDevice (enbNode).Get (0));
110 auto ueDevs = lteHelper->InstallUeDevice (ueNode);
111 auto ueDev = DynamicCast<LteUeNetDevice> (ueDevs.Get (0));
116 std::map< uint8_t, Ptr<ComponentCarrierUe> > ueCcMap = ueDev->GetCcMap ();
117 ueDev->SetDlEarfcn (ueCcMap.at (numberOfComponentCarriers - 1)->GetDlEarfcn ());
118 lteHelper->Attach (ueDevs);
119 m_expectedCellId = enbDev->GetCcMap ().at (numberOfComponentCarriers - 1)->GetCellId ();
122 const uint16_t
port = 21;
126 auto sink = CreateObject<PacketSink> ();
129 ueNode->AddApplication (
sink);
132 auto client = CreateObject<UdpClient> ();
134 client->SetAttribute (
"MaxPackets",
UintegerValue (1000000));
137 client->SetAttribute (
"RemoteAddress",
AddressValue (ueIpIface.GetAddress (0)));
138 pgwNode->AddApplication (client);
143 Simulator::Stop (
Seconds (2.0));
148 Simulator::Destroy ();
155 std::vector<double> throughputs;
156 for (uint8_t i = 1; i <= 4; i++)
161 double average = std::accumulate(begin (throughputs), end (throughputs), 0.0) / throughputs.size ();
162 for (
double throughput: throughputs)
164 NS_TEST_ASSERT_MSG_EQ_TOL (throughput, average, average * 0.01,
"Throughput does not scale with number of component carriers");
holds a vector of ns3::Application pointers.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
LteAggregationThroughputScaleTestSuite()
holds a vector of std::pair of Ptr<Ipv4> and interface index.
static TypeId GetTypeId()
Get the type ID.
Hold variables of type string.
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
static LteAggregationThroughputScaleTestSuite g_lteAggregationThroughputScaleTestSuite
uint64_t GetTotalRx() const
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
aggregate IP/TCP/UDP functionality to existing Nodes.
AttributeValue implementation for Time.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
LteAggregationThroughputScaleTestCase(std::string name)
Creates an instance of the carrier aggregation throughput scaling test case.
Hold an unsigned integer type.
#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.
uint16_t m_actualCellId
Cell ID UE has attached to.
AttributeValue implementation for TypeId.
virtual void DoRun()
Setup the simulation, run it, and verify the result.
Test suite for executing carrier aggregation throughput scaling test case.
Testing that UE throughput scales linearly with number of component carriers.
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Access to the IPv4 forwarding table, interfaces, and configuration.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
Helper class used to assign positions and mobility models to nodes.
AttributeValue implementation for Address.
std::string GetName(void) const
Helper class that adds ns3::Ipv4StaticRouting objects.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetDefault(std::string name, const AttributeValue &value)
double GetThroughput(uint8_t numberOfComponentCarriers)
Get throughput function.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
uint16_t m_expectedCellId
Cell ID UE is expected to attach to.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
virtual ~LteAggregationThroughputScaleTestCase()