View | Details | Raw Unified | Return to bug 2029
Collapse All | Expand All

(-)a/src/lte/model/lte-ue-cphy-sap.h (+12 lines)
 Lines 139-144    Link Here 
139
   */
139
   */
140
  virtual void SetSrsConfigurationIndex (uint16_t srcCi) = 0;
140
  virtual void SetSrsConfigurationIndex (uint16_t srcCi) = 0;
141
141
142
  /**
143
   * \param pa the P_A value
144
   */
145
  virtual void SetPa (double pa) = 0;
146
142
};
147
};
143
148
144
149
 Lines 231-236    Link Here 
231
  virtual void SetRnti (uint16_t rnti);
236
  virtual void SetRnti (uint16_t rnti);
232
  virtual void SetTransmissionMode (uint8_t txMode);
237
  virtual void SetTransmissionMode (uint8_t txMode);
233
  virtual void SetSrsConfigurationIndex (uint16_t srcCi);
238
  virtual void SetSrsConfigurationIndex (uint16_t srcCi);
239
  virtual void SetPa (double pa);
234
240
235
private:
241
private:
236
  MemberLteUeCphySapProvider ();
242
  MemberLteUeCphySapProvider ();
 Lines 318-323    Link Here 
318
  m_owner->DoSetSrsConfigurationIndex (srcCi);
324
  m_owner->DoSetSrsConfigurationIndex (srcCi);
319
}
325
}
320
326
327
template <class C>
328
void
329
MemberLteUeCphySapProvider<C>::SetPa (double pa)
330
{
331
  m_owner->DoSetPa (pa);
332
}
321
333
322
334
323
/**
335
/**
(-)a/src/lte/model/lte-ue-phy.cc (-1 / +27 lines)
 Lines 441-447    Link Here 
441
441
442
  if (m_dataInterferencePowerUpdated)
442
  if (m_dataInterferencePowerUpdated)
443
    {
443
    {
444
      SpectrumValue mixedSinr = m_rsReceivedPower / m_dataInterferencePower;
444
      SpectrumValue mixedSinr = (m_rsReceivedPower * m_paLinear) / m_dataInterferencePower;
445
446
      /*
447
       * some RBs are not used in PDSCH and their SINR is very high
448
       * for example with bandwidth 25, last RB is not used
449
       * it can make avgSinr value very high, what is incorrect
450
       */
451
      uint32_t rbgSize = GetRbgSize ();
452
      uint32_t modulo = m_dlBandwidth % rbgSize;
453
      double avgMixedSinr = 0;
454
      uint32_t usedRbgNum = 0;
455
      for(uint32_t i = 0; i < (m_dlBandwidth-1-modulo); i++) {
456
          usedRbgNum++;
457
          avgMixedSinr+=mixedSinr[i];
458
        }
459
      avgMixedSinr = avgMixedSinr/usedRbgNum;
460
      for(uint32_t i = 0; i < modulo; i++) {
461
          mixedSinr[m_dlBandwidth-1-i] = avgMixedSinr;
462
        }
463
445
      GenerateMixedCqiReport (mixedSinr);
464
      GenerateMixedCqiReport (mixedSinr);
446
      m_dataInterferencePowerUpdated = false;
465
      m_dataInterferencePowerUpdated = false;
447
      return;
466
      return;
 Lines 1229-1234    Link Here 
1229
  m_rsrpSinrSampleCounter = 0;
1248
  m_rsrpSinrSampleCounter = 0;
1230
  m_p10CqiLast = Simulator::Now ();
1249
  m_p10CqiLast = Simulator::Now ();
1231
  m_a30CqiLast = Simulator::Now ();
1250
  m_a30CqiLast = Simulator::Now ();
1251
  m_paLinear = 1;
1232
1252
1233
  m_packetBurstQueue.clear ();
1253
  m_packetBurstQueue.clear ();
1234
  m_controlMessagesQueue.clear ();
1254
  m_controlMessagesQueue.clear ();
 Lines 1367-1372    Link Here 
1367
  NS_LOG_DEBUG (this << " UE SRS P " << m_srsPeriodicity << " RNTI " << m_rnti << " offset " << m_srsSubframeOffset << " cellId " << m_cellId << " CI " << srcCi);
1387
  NS_LOG_DEBUG (this << " UE SRS P " << m_srsPeriodicity << " RNTI " << m_rnti << " offset " << m_srsSubframeOffset << " cellId " << m_cellId << " CI " << srcCi);
1368
}
1388
}
1369
1389
1390
void
1391
LteUePhy::DoSetPa (double pa)
1392
{
1393
  NS_LOG_FUNCTION (this << pa);
1394
  m_paLinear = pow (10,(pa/10));
1395
}
1370
1396
1371
void 
1397
void 
1372
LteUePhy::SetTxMode1Gain (double gain)
1398
LteUePhy::SetTxMode1Gain (double gain)
(-)a/src/lte/model/lte-ue-phy.h (+3 lines)
 Lines 273-278    Link Here 
273
  void DoSetRnti (uint16_t rnti);
273
  void DoSetRnti (uint16_t rnti);
274
  void DoSetTransmissionMode (uint8_t txMode);
274
  void DoSetTransmissionMode (uint8_t txMode);
275
  void DoSetSrsConfigurationIndex (uint16_t srcCi);
275
  void DoSetSrsConfigurationIndex (uint16_t srcCi);
276
  void DoSetPa (double pa);
276
277
277
  // UE PHY SAP methods 
278
  // UE PHY SAP methods 
278
  virtual void DoSendMacPdu (Ptr<Packet> p);
279
  virtual void DoSendMacPdu (Ptr<Packet> p);
 Lines 314-319    Link Here 
314
  uint16_t m_srsConfigured;
315
  uint16_t m_srsConfigured;
315
  Time     m_srsStartTime;
316
  Time     m_srsStartTime;
316
317
318
  double m_paLinear;
319
317
  bool m_dlConfigured;
320
  bool m_dlConfigured;
318
  bool m_ulConfigured;
321
  bool m_ulConfigured;
319
322
(-)a/src/lte/model/lte-ue-rrc.cc (-2 / +4 lines)
 Lines 1099-1106    Link Here 
1099
  if (pcd.havePdschConfigDedicated)
1099
  if (pcd.havePdschConfigDedicated)
1100
    {
1100
    {
1101
      // update PdschConfigDedicated (i.e. P_A value)
1101
      // update PdschConfigDedicated (i.e. P_A value)
1102
	  m_pdschConfigDedicated = pcd.pdschConfigDedicated;
1102
      m_pdschConfigDedicated = pcd.pdschConfigDedicated;
1103
   }
1103
      double paDouble = LteRrcSap::ConvertPdschConfigDedicated2Double (m_pdschConfigDedicated);
1104
      m_cphySapProvider->SetPa (paDouble);
1105
    }
1104
1106
1105
  std::list<LteRrcSap::SrbToAddMod>::const_iterator stamIt = rrcd.srbToAddModList.begin ();
1107
  std::list<LteRrcSap::SrbToAddMod>::const_iterator stamIt = rrcd.srbToAddModList.begin ();
1106
  if (stamIt != rrcd.srbToAddModList.end ())
1108
  if (stamIt != rrcd.srbToAddModList.end ())
(-)a/src/lte/test/lte-test-cqi-generation.cc (+167 lines)
 Lines 32-37    Link Here 
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");
 Lines 54-59    Link Here 
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
 Lines 69-74    Link Here 
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;
 Lines 206-208    Link Here 
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
(-)a/src/lte/test/lte-test-cqi-generation.h (+24 lines)
 Lines 54-57    Link Here 
54
54
55
};
55
};
56
56
57
class LteCqiGenerationDlPowerControlTestCase : public TestCase
58
{
59
public:
60
  LteCqiGenerationDlPowerControlTestCase (std::string name, uint8_t cell0Pa, uint8_t cell1Pa,
61
                                          uint16_t dlMcs, uint16_t ulMcs);
62
  virtual ~LteCqiGenerationDlPowerControlTestCase ();
63
64
  void DlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
65
                     uint8_t mcsTb1, uint16_t sizeTb1, uint8_t mcsTb2, uint16_t sizeTb2);
66
67
  void UlScheduling (uint32_t frameNo, uint32_t subframeNo, uint16_t rnti,
68
                     uint8_t mcs, uint16_t sizeTb);
69
70
private:
71
  virtual void DoRun (void);
72
73
  uint8_t m_cell0Pa;
74
  uint8_t m_cell1Pa;
75
76
  uint16_t m_dlMcs;
77
  uint16_t m_ulMcs;
78
79
};
80
57
#endif /* LTE_TEST_CQI_GENERATION_H */
81
#endif /* LTE_TEST_CQI_GENERATION_H */

Return to bug 2029