|
|
| 32 |
#include "ns3/mobility-helper.h" |
32 |
#include "ns3/mobility-helper.h" |
| 33 |
#include "ns3/lte-helper.h" |
33 |
#include "ns3/lte-helper.h" |
| 34 |
|
34 |
|
|
|
35 |
#include "lte-ffr-simple.h" |
| 36 |
#include "ns3/lte-rrc-sap.h" |
| 37 |
|
| 35 |
#include "lte-test-cqi-generation.h" |
38 |
#include "lte-test-cqi-generation.h" |
| 36 |
|
39 |
|
| 37 |
NS_LOG_COMPONENT_DEFINE ("LteCqiGenerationTest"); |
40 |
NS_LOG_COMPONENT_DEFINE ("LteCqiGenerationTest"); |
|
|
| 54 |
testcase->UlScheduling (frameNo, subframeNo, rnti, mcs, sizeTb); |
57 |
testcase->UlScheduling (frameNo, subframeNo, rnti, mcs, sizeTb); |
| 55 |
} |
58 |
} |
| 56 |
|
59 |
|
|
|
60 |
void |
| 61 |
LteTestDlSchedulingCallback2 (LteCqiGenerationDlPowerControlTestCase *testcase, std::string path, |
| 62 |
uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, |
| 63 |
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2) |
| 64 |
{ |
| 65 |
testcase->DlScheduling (frameNo, subframeNo, rnti, mcsTb1, sizeTb1, mcsTb2, sizeTb2); |
| 66 |
} |
| 67 |
|
| 68 |
void |
| 69 |
LteTestUlSchedulingCallback2 (LteCqiGenerationDlPowerControlTestCase *testcase, std::string path, |
| 70 |
uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, |
| 71 |
uint8_t mcs, uint16_t sizeTb) |
| 72 |
{ |
| 73 |
testcase->UlScheduling (frameNo, subframeNo, rnti, mcs, sizeTb); |
| 74 |
} |
| 75 |
|
| 57 |
|
76 |
|
| 58 |
/** |
77 |
/** |
| 59 |
* TestSuite |
78 |
* TestSuite |
|
|
| 69 |
AddTestCase (new LteCqiGenerationTestCase ("UsePdcchForCqiGeneration", false, 4, 2), TestCase::QUICK); |
88 |
AddTestCase (new LteCqiGenerationTestCase ("UsePdcchForCqiGeneration", false, 4, 2), TestCase::QUICK); |
| 70 |
AddTestCase (new LteCqiGenerationTestCase ("UsePdschForCqiGeneration", true, 28, 2), TestCase::QUICK); |
89 |
AddTestCase (new LteCqiGenerationTestCase ("UsePdschForCqiGeneration", true, 28, 2), TestCase::QUICK); |
| 71 |
|
90 |
|
|
|
91 |
AddTestCase (new LteCqiGenerationDlPowerControlTestCase ("CqiGenerationWithDlPowerControl", |
| 92 |
LteRrcSap::PdschConfigDedicated::dB0, LteRrcSap::PdschConfigDedicated::dB0, 4, 2), TestCase::QUICK); |
| 93 |
AddTestCase (new LteCqiGenerationDlPowerControlTestCase ("CqiGenerationWithDlPowerControl", |
| 94 |
LteRrcSap::PdschConfigDedicated::dB0, LteRrcSap::PdschConfigDedicated::dB_3, 8, 2), TestCase::QUICK); |
| 95 |
AddTestCase (new LteCqiGenerationDlPowerControlTestCase ("CqiGenerationWithDlPowerControl", |
| 96 |
LteRrcSap::PdschConfigDedicated::dB0, LteRrcSap::PdschConfigDedicated::dB_6, 10, 2), TestCase::QUICK); |
| 97 |
AddTestCase (new LteCqiGenerationDlPowerControlTestCase ("CqiGenerationWithDlPowerControl", |
| 98 |
LteRrcSap::PdschConfigDedicated::dB1, LteRrcSap::PdschConfigDedicated::dB_6, 12, 2), TestCase::QUICK); |
| 99 |
AddTestCase (new LteCqiGenerationDlPowerControlTestCase ("CqiGenerationWithDlPowerControl", |
| 100 |
LteRrcSap::PdschConfigDedicated::dB2, LteRrcSap::PdschConfigDedicated::dB_6, 14, 2), TestCase::QUICK); |
| 101 |
AddTestCase (new LteCqiGenerationDlPowerControlTestCase ("CqiGenerationWithDlPowerControl", |
| 102 |
LteRrcSap::PdschConfigDedicated::dB3, LteRrcSap::PdschConfigDedicated::dB_6, 14, 2), TestCase::QUICK); |
| 103 |
AddTestCase (new LteCqiGenerationDlPowerControlTestCase ("CqiGenerationWithDlPowerControl", |
| 104 |
LteRrcSap::PdschConfigDedicated::dB3, LteRrcSap::PdschConfigDedicated::dB0, 8, 2), TestCase::QUICK); |
| 72 |
} |
105 |
} |
| 73 |
|
106 |
|
| 74 |
static LteCqiGenerationTestSuite lteCqiGenerationTestSuite; |
107 |
static LteCqiGenerationTestSuite lteCqiGenerationTestSuite; |
|
|
| 206 |
|
239 |
|
| 207 |
Simulator::Destroy (); |
240 |
Simulator::Destroy (); |
| 208 |
} |
241 |
} |
|
|
242 |
|
| 243 |
LteCqiGenerationDlPowerControlTestCase::LteCqiGenerationDlPowerControlTestCase (std::string name, |
| 244 |
uint8_t cell0Pa, uint8_t cell1Pa, uint16_t dlMcs, uint16_t ulMcs) |
| 245 |
: TestCase ("Downlink Power Control: " + name), |
| 246 |
m_cell0Pa (cell0Pa), |
| 247 |
m_cell1Pa (cell1Pa), |
| 248 |
m_dlMcs (dlMcs), |
| 249 |
m_ulMcs (ulMcs) |
| 250 |
{ |
| 251 |
NS_LOG_INFO ("Creating LteCqiGenerationTestCase"); |
| 252 |
} |
| 253 |
|
| 254 |
LteCqiGenerationDlPowerControlTestCase::~LteCqiGenerationDlPowerControlTestCase () |
| 255 |
{ |
| 256 |
} |
| 257 |
|
| 258 |
void |
| 259 |
LteCqiGenerationDlPowerControlTestCase::DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, |
| 260 |
uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2) |
| 261 |
{ |
| 262 |
// need to allow for RRC connection establishment + CQI feedback reception |
| 263 |
if (Simulator::Now () > MilliSeconds (500)) |
| 264 |
{ |
| 265 |
// NS_LOG_UNCOND("DL MSC: " << (uint32_t)mcsTb1 << " expected DL MCS: " << (uint32_t)m_dlMcs); |
| 266 |
NS_TEST_ASSERT_MSG_EQ ((uint32_t)mcsTb1, (uint32_t)m_dlMcs, "Wrong DL MCS "); |
| 267 |
} |
| 268 |
} |
| 269 |
|
| 270 |
void |
| 271 |
LteCqiGenerationDlPowerControlTestCase::UlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti, |
| 272 |
uint8_t mcs, uint16_t sizeTb) |
| 273 |
{ |
| 274 |
// need to allow for RRC connection establishment + SRS transmission |
| 275 |
if (Simulator::Now () > MilliSeconds (500)) |
| 276 |
{ |
| 277 |
// NS_LOG_UNCOND("UL MSC: " << (uint32_t)mcs << " expected UL MCS: " << (uint32_t)m_ulMcs); |
| 278 |
NS_TEST_ASSERT_MSG_EQ ((uint32_t)mcs, (uint32_t)m_ulMcs, "Wrong UL MCS"); |
| 279 |
} |
| 280 |
} |
| 281 |
|
| 282 |
void |
| 283 |
LteCqiGenerationDlPowerControlTestCase::DoRun (void) |
| 284 |
{ |
| 285 |
NS_LOG_DEBUG ("LteCqiGenerationTestCase"); |
| 286 |
|
| 287 |
Config::Reset (); |
| 288 |
Config::SetDefault ("ns3::LteHelper::UseIdealRrc", BooleanValue (true)); |
| 289 |
Config::SetDefault ("ns3::LteHelper::UsePdschForCqiGeneration", BooleanValue (true)); |
| 290 |
|
| 291 |
Config::SetDefault ("ns3::LteSpectrumPhy::CtrlErrorModelEnabled", BooleanValue (true)); |
| 292 |
Config::SetDefault ("ns3::LteSpectrumPhy::DataErrorModelEnabled", BooleanValue (true)); |
| 293 |
|
| 294 |
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> (); |
| 295 |
lteHelper->SetFfrAlgorithmType ("ns3::LteFfrSimple"); |
| 296 |
|
| 297 |
// Create Nodes: eNodeB and UE |
| 298 |
NodeContainer enbNodes; |
| 299 |
NodeContainer ueNodes1; |
| 300 |
NodeContainer ueNodes2; |
| 301 |
enbNodes.Create (2); |
| 302 |
ueNodes1.Create (1); |
| 303 |
ueNodes2.Create (1); |
| 304 |
NodeContainer allNodes = NodeContainer ( enbNodes, ueNodes1, ueNodes2); |
| 305 |
|
| 306 |
/* |
| 307 |
* The topology is the following: |
| 308 |
* |
| 309 |
* eNB1 UE1 UE2 eNB2 |
| 310 |
* | | | |
| 311 |
* x -------------------------- x -------------------------- x |
| 312 |
* 500 m 500 m |
| 313 |
* |
| 314 |
*/ |
| 315 |
|
| 316 |
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> (); |
| 317 |
positionAlloc->Add (Vector (0.0, 0.0, 0.0)); // eNB1 |
| 318 |
positionAlloc->Add (Vector (1000, 0.0, 0.0)); // eNB2 |
| 319 |
positionAlloc->Add (Vector (500.0, 0.0, 0.0)); // UE1 |
| 320 |
positionAlloc->Add (Vector (500, 0.0, 0.0)); // UE2 |
| 321 |
MobilityHelper mobility; |
| 322 |
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
| 323 |
mobility.SetPositionAllocator (positionAlloc); |
| 324 |
mobility.Install (allNodes); |
| 325 |
|
| 326 |
// Create Devices and install them in the Nodes (eNB and UE) |
| 327 |
NetDeviceContainer enbDevs; |
| 328 |
NetDeviceContainer ueDevs1; |
| 329 |
NetDeviceContainer ueDevs2; |
| 330 |
lteHelper->SetSchedulerType ("ns3::PfFfMacScheduler"); |
| 331 |
lteHelper->SetSchedulerAttribute ("UlCqiFilter", EnumValue (FfMacScheduler::PUSCH_UL_CQI)); |
| 332 |
enbDevs = lteHelper->InstallEnbDevice (enbNodes); |
| 333 |
ueDevs1 = lteHelper->InstallUeDevice (ueNodes1); |
| 334 |
ueDevs2 = lteHelper->InstallUeDevice (ueNodes2); |
| 335 |
|
| 336 |
// Attach a UE to a eNB |
| 337 |
lteHelper->Attach (ueDevs1, enbDevs.Get (0)); |
| 338 |
lteHelper->Attach (ueDevs2, enbDevs.Get (1)); |
| 339 |
|
| 340 |
// Activate an EPS bearer |
| 341 |
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE; |
| 342 |
EpsBearer bearer (q); |
| 343 |
lteHelper->ActivateDataRadioBearer (ueDevs1, bearer); |
| 344 |
lteHelper->ActivateDataRadioBearer (ueDevs2, bearer); |
| 345 |
|
| 346 |
PointerValue tmp; |
| 347 |
enbDevs.Get (0)->GetAttribute ("LteFfrAlgorithm", tmp); |
| 348 |
Ptr<LteFfrSimple> simpleFfrAlgorithmEnb0 = DynamicCast<LteFfrSimple>(tmp.GetObject ()); |
| 349 |
simpleFfrAlgorithmEnb0->ChangePdschConfigDedicated (true); |
| 350 |
|
| 351 |
LteRrcSap::PdschConfigDedicated pdschConfigDedicatedEnb0; |
| 352 |
pdschConfigDedicatedEnb0.pa = m_cell0Pa; |
| 353 |
simpleFfrAlgorithmEnb0->SetPdschConfigDedicated (pdschConfigDedicatedEnb0); |
| 354 |
|
| 355 |
enbDevs.Get (1)->GetAttribute ("LteFfrAlgorithm", tmp); |
| 356 |
Ptr<LteFfrSimple> simpleFfrAlgorithmEnb1 = DynamicCast<LteFfrSimple>(tmp.GetObject ()); |
| 357 |
simpleFfrAlgorithmEnb1->ChangePdschConfigDedicated (true); |
| 358 |
|
| 359 |
LteRrcSap::PdschConfigDedicated pdschConfigDedicatedEnb1; |
| 360 |
pdschConfigDedicatedEnb1.pa = m_cell1Pa; |
| 361 |
simpleFfrAlgorithmEnb1->SetPdschConfigDedicated (pdschConfigDedicatedEnb1); |
| 362 |
|
| 363 |
|
| 364 |
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/DlScheduling", |
| 365 |
MakeBoundCallback (&LteTestDlSchedulingCallback2, this)); |
| 366 |
|
| 367 |
Config::Connect ("/NodeList/0/DeviceList/0/LteEnbMac/UlScheduling", |
| 368 |
MakeBoundCallback (&LteTestUlSchedulingCallback2, this)); |
| 369 |
|
| 370 |
Simulator::Stop (Seconds (1.100)); |
| 371 |
Simulator::Run (); |
| 372 |
|
| 373 |
Simulator::Destroy (); |
| 374 |
} |
| 375 |
|