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

(-)a/src/lte/model/lte-spectrum-value-helper.cc (+22 lines)
 Lines 332-338    Link Here 
332
  return txPsd;
332
  return txPsd;
333
}
333
}
334
334
335
Ptr<SpectrumValue>
336
LteSpectrumValueHelper::CreateUlTxPowerSpectralDensity (uint16_t earfcn, uint8_t txBandwidthConfiguration, double powerTx, std::vector <int> activeRbs)
337
{
338
  NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << powerTx << activeRbs);
335
339
340
  Ptr<SpectrumModel> model = GetSpectrumModel (earfcn, txBandwidthConfiguration);
341
  Ptr<SpectrumValue> txPsd = Create <SpectrumValue> (model);
342
343
  // powerTx is expressed in dBm. We must convert it into natural unit.
344
  double powerTxW = std::pow (10., (powerTx - 30) / 10);
345
346
  double txPowerDensity = (powerTxW / (activeRbs.size() * 180000));
347
348
  for (std::vector <int>::iterator it = activeRbs.begin (); it != activeRbs.end (); it++)
349
    {
350
      int rbId = (*it);
351
      (*txPsd)[rbId] = txPowerDensity;
352
    }
353
354
  NS_LOG_LOGIC (*txPsd);
355
356
  return txPsd;
357
}
336
358
337
Ptr<SpectrumValue>
359
Ptr<SpectrumValue>
338
LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint32_t earfcn, uint8_t txBandwidthConfiguration, double noiseFigure)
360
LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint32_t earfcn, uint8_t txBandwidthConfiguration, double noiseFigure)
(-)a/src/lte/model/lte-spectrum-value-helper.h (+17 lines)
 Lines 153-158    Link Here 
153
                                                          std::vector <int> activeRbs);
153
                                                          std::vector <int> activeRbs);
154
154
155
  /**
155
  /**
156
   * create a spectrum value representing the uplink power spectral
157
   * density of a signal to be transmitted. See 3GPP TS 36.101 for
158
   * a definition of most of the parameters described here.
159
   * This function splits the power over the active RBs instead of
160
   * the entire bandwidth
161
   * \param earfcn the carrier frequency (EARFCN) of the transmission
162
   * \param powerTx the total power in dBm over the whole bandwidth
163
   * \param activeRbs the list of Active Resource Blocks (PRBs)
164
   *
165
   * \return a pointer to a newly allocated SpectrumValue representing the TX Power Spectral Density in W/Hz for each Resource Block
166
   */
167
  static Ptr<SpectrumValue> CreateUlTxPowerSpectralDensity (uint16_t earfcn,
168
                                                            uint8_t bandwidth,
169
                                                            double powerTx,
170
                                                            std::vector <int> activeRbs);
171
172
  /**
156
   * create a SpectrumValue that models the power spectral density of AWGN
173
   * create a SpectrumValue that models the power spectral density of AWGN
157
   *
174
   *
158
   * \param earfcn the carrier frequency (EARFCN) at which reception
175
   * \param earfcn the carrier frequency (EARFCN) at which reception
(-)a/src/lte/model/lte-ue-phy.cc (-1 / +1 lines)
 Lines 468-474    Link Here 
468
{
468
{
469
  NS_LOG_FUNCTION (this);
469
  NS_LOG_FUNCTION (this);
470
  LteSpectrumValueHelper psdHelper;
470
  LteSpectrumValueHelper psdHelper;
471
  Ptr<SpectrumValue> psd = psdHelper.CreateTxPowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_txPower, GetSubChannelsForTransmission ());
471
  Ptr<SpectrumValue> psd = psdHelper.CreateUlTxPowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_txPower, GetSubChannelsForTransmission ());
472
472
473
  return psd;
473
  return psd;
474
}
474
}
(-)a/src/lte/test/lte-test-frequency-reuse.cc (-1 / +20 lines)
 Lines 524-532    Link Here 
524
  NS_LOG_DEBUG ("UL DATA Power allocation :");
524
  NS_LOG_DEBUG ("UL DATA Power allocation :");
525
  Values::const_iterator it;
525
  Values::const_iterator it;
526
  uint32_t i = 0;
526
  uint32_t i = 0;
527
  uint32_t numActiveRbs = 0;
528
529
  // At the moment I could not find a better way to find total number
530
  // of active RBs. This method is independent of the bandwidth
531
  // configuration done in a test scenario, thus, it requires
532
  // minimum change to the script.
527
  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
533
  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
528
    {
534
    {
529
      double power =  (*it) * (m_ulBandwidth * 180000);
535
      // Count the RB as active if it is part of
536
      // the expected UL RBs and has Power Spectral Density (PSD) > 0
537
      if (m_expectedUlRb[numActiveRbs] == true && (*it) > 0)
538
        {
539
          numActiveRbs++;
540
        }
541
    }
542
  NS_LOG_DEBUG ("Total number of active RBs = " << numActiveRbs);
543
544
  // The uplink power control and the uplink PSD
545
  // calculation only consider active resource block.
546
  for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
547
    {
548
      double power =  (*it) * (numActiveRbs * 180000);
530
      NS_LOG_DEBUG ("RB " << i << " POWER: " << power << " expectedUlPower: " << m_expectedUlPower);
549
      NS_LOG_DEBUG ("RB " << i << " POWER: " << power << " expectedUlPower: " << m_expectedUlPower);
531
      if (m_expectedUlRb[i] == false && power > 0)
550
      if (m_expectedUlRb[i] == false && power > 0)
532
        {
551
        {

Return to bug 2339