14#include "ns3/boolean.h"
15#include "ns3/callback.h"
16#include "ns3/config.h"
17#include "ns3/double.h"
19#include "ns3/ff-mac-scheduler.h"
21#include "ns3/lte-chunk-processor.h"
22#include "ns3/lte-common.h"
23#include "ns3/lte-enb-net-device.h"
24#include "ns3/lte-enb-phy.h"
25#include "ns3/lte-enb-rrc.h"
26#include "ns3/lte-helper.h"
27#include "ns3/lte-rrc-sap.h"
28#include "ns3/lte-ue-net-device.h"
29#include "ns3/lte-ue-phy.h"
30#include "ns3/lte-ue-rrc.h"
31#include "ns3/mobility-helper.h"
32#include "ns3/pointer.h"
33#include "ns3/simulator.h"
34#include "ns3/string.h"
49 NS_LOG_INFO(
"Creating LteDownlinkPowerControlTestSuite");
59 uint16_t earfcn = 500;
88 "txpowdB30nrb6run1earfcn500_allRbPower",
95 TestCase::Duration::QUICK);
105 uint16_t earfcn = 500;
131 "txpowdB30nrb6run1earfcn500",
138 TestCase::Duration::QUICK);
158 uint16_t earfcn = 500;
224 "txpowdB30nrb25run1earfcn500_allRbPower",
231 TestCase::Duration::QUICK);
252 uint16_t earfcn = 500;
308 "txpowdB30nrb25run1earfcn500",
315 TestCase::Duration::QUICK);
321 "DataCtrlPowerDifference_noChange"),
322 TestCase::Duration::QUICK);
325 "DataCtrlPowerDifference_dB_6"),
326 TestCase::Duration::QUICK);
329 "DataCtrlPowerDifference_dB_4dot77"),
330 TestCase::Duration::QUICK);
333 "DataCtrlPowerDifference_dB_3"),
334 TestCase::Duration::QUICK);
337 "DataCtrlPowerDifference_dB_1dot77"),
338 TestCase::Duration::QUICK);
341 "DataCtrlPowerDifference_dB0"),
342 TestCase::Duration::QUICK);
345 "DataCtrlPowerDifference_dB1"),
346 TestCase::Duration::QUICK);
349 "DataCtrlPowerDifference_dB2"),
350 TestCase::Duration::QUICK);
353 "DataCtrlPowerDifference_dB3"),
354 TestCase::Duration::QUICK);
359 "RrcConnReconf-IdealRrc"),
360 TestCase::Duration::QUICK);
363 "RrcConnReconf-RealRrc"),
364 TestCase::Duration::QUICK);
371 pdschConfigDedicated.
pa = pa;
396 :
TestCase(
"Downlink Power Control: " + name),
404 NS_LOG_INFO(
"Creating LteDownlinkPowerControlTestCase");
414 NS_LOG_INFO(
"Creating LteDownlinkPowerControlSpectrumValueTestCase");
417 "SpectrumModel UID mismatch");
421 "SpectrumValues not equal");
427 :
TestCase(
"Downlink Power Control: " + name)
432 NS_LOG_INFO(
"Creating LteDownlinkPowerControlTestCase");
450 lteHelper->SetFfrAlgorithmType(
"ns3::LteFfrSimple");
461 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
467 lteHelper->SetSchedulerType(
"ns3::PfFfMacScheduler");
518 "Downlink Data and Ctrl Power Difference are not equal within tolerance");
531 testcase->ConnectionReconfigurationUe(context, imsi, cellId, rnti);
542 testcase->ConnectionReconfigurationEnb(context, imsi, cellId, rnti);
552 testcase->ChangePdschConfigDedicated(rnti, pa);
557 :
TestCase(
"Downlink Power Control: " + name),
559 m_changePdschConfigDedicatedTriggered(
false),
560 m_connectionReconfigurationUeReceived(
false),
561 m_connectionReconfigurationEnbCompleted(
false)
603 NS_LOG_DEBUG(
"FFR Algorithm ChangePdschConfigDedicated");
618 lteHelper->SetFfrAlgorithmType(
"ns3::LteFfrSimple");
629 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
635 lteHelper->SetSchedulerType(
"ns3::PfFfMacScheduler");
655 Config::Connect(
"/NodeList/0/DeviceList/0/LteFfrAlgorithm/ChangePdschConfigDedicated",
657 Config::Connect(
"/NodeList/1/DeviceList/0/LteUeRrc/ConnectionReconfiguration",
659 Config::Connect(
"/NodeList/0/DeviceList/0/LteEnbRrc/ConnectionReconfiguration",
667 "Ffr have not changed PdschConfigDedicated for UE");
670 "Ue have not received RrcConnectionReconfiguration");
673 "Enb have not received RrcConnectionReconfigurationCompleted");
Test if RRC connection reconfiguration messages are properly generated upon the change in the downlin...
~LteDownlinkPowerControlRrcConnectionReconfigurationTestCase() override
void ConnectionReconfigurationEnb(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Connection Reconfiguration ENB.
LteDownlinkPowerControlRrcConnectionReconfigurationTestCase(bool useIdealRrc, std::string name)
Constructor.
void ConnectionReconfigurationUe(std::string context, uint64_t imsi, uint16_t cellid, uint16_t rnti)
Connection Reconfiguration UE.
void DoRun() override
Implementation to actually run this TestCase.
bool m_useIdealRrc
use ideal RRC?
bool m_changePdschConfigDedicatedTriggered
change PDSCH config dedicated triggered?
bool m_connectionReconfigurationUeReceived
connection reconfiguration UE received?
void ChangePdschConfigDedicated(uint16_t rnti, uint8_t pa)
Change PDSCH config dedicated.
bool m_connectionReconfigurationEnbCompleted
connection reconfiguration ENB completed?
Test SINR calculation in the downlink when power control is used.
LteDownlinkPowerControlSpectrumValueTestCase(std::string name, uint16_t earfcn, uint16_t bw, double powerTx, std::map< int, double > powerTxMap, std::vector< int > activeRbs, SpectrumValue &expected)
Constructor.
Ptr< SpectrumValue > m_actual
actual Tx Power Spectral Density
void DoRun() override
Implementation to actually run this TestCase.
Ptr< SpectrumValue > m_expected
expected Tx Power Spectral Density
~LteDownlinkPowerControlSpectrumValueTestCase() override
Test SINR calculation in the downlink when the power control is used.
double m_expectedPowerDiff
expected power difference
~LteDownlinkPowerControlTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
LteRrcSap::PdschConfigDedicated m_pdschConfigDedicated
PDSCH config dedicated.
LteDownlinkPowerControlTestCase(bool changePower, uint8_t pa, std::string name)
Constructor.
bool m_changePdschConfigDedicated
PDSCH config dedicated change.
Test suite for the LteDownlinkPowerControlSpectrumValueTestCase.
double CalculateRbTxPower(double txPower, uint8_t pa)
Calculate RB transmit power function.
LteDownlinkPowerControlTestSuite()
TestSuite.
AttributeValue implementation for Boolean.
This class contains the specification of EPS Bearers.
@ NGBR_VIDEO_TCP_DEFAULT
Non-GBR TCP-based Video (Buffered Streaming, e.g., www, e-mail...)
The LtePhy models the physical layer of LTE.
static double ConvertPdschConfigDedicated2Double(PdschConfigDedicated pdschConfigDedicated)
Convert PDSCH config dedicated function.
A sink to be plugged to the callback of LteChunkProcessor allowing to save and later retrieve the lat...
void ReportValue(const SpectrumValue &value)
function to be plugged to LteChunkProcessor::AddCallback ()
This class defines all functions to create spectrum model for lte.
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t earfcn, uint16_t bandwidth)
The LteUeNetDevice class implements the UE net device.
Helper class used to assign positions and mobility models to nodes.
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< T > GetObject() const
Get a pointer to the requested aggregated Object.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
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.
Set of values corresponding to a given SpectrumModel.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
void Reset()
Reset the initial value of every attribute as well as the value of every global to what they were bef...
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
static LteDownlinkPowerControlTestSuite lteDownlinkPowerControlTestSuite
Static variable for test initialization.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(actual, expected, tol, msg)
Test if two SpectrumValue instances are equal within a given tolerance.
#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.
#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...
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
void NotifyConnectionReconfigurationUe(LteDownlinkPowerControlRrcConnectionReconfigurationTestCase *testcase, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
void NotifyConnectionReconfigurationEnb(LteDownlinkPowerControlRrcConnectionReconfigurationTestCase *testcase, std::string context, uint64_t imsi, uint16_t cellId, uint16_t rnti)
void ChangePdschConfigDedicatedCallback(LteDownlinkPowerControlRrcConnectionReconfigurationTestCase *testcase, std::string context, uint16_t rnti, uint8_t pa)
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...
PdschConfigDedicated structure.
Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double fcHz, double pwrDbm, double bwHz, double rbWidthHz)
Create the PSD for the TX.