lte: (fixes #2339) use only the active RBs for uplink PSD computation

Thanks to:
Alexander Krotov <krotov@iitp.ru> for reporting
NIST to provide CreateUlTxPowerSpectralDensity function
This commit is contained in:
Zoraze Ali
2018-09-07 12:13:43 +02:00
parent ee06a32879
commit 09f89c07e4
4 changed files with 60 additions and 2 deletions

View File

@@ -332,7 +332,29 @@ LteSpectrumValueHelper::CreateTxPowerSpectralDensity (uint32_t earfcn, uint8_t t
return txPsd;
}
Ptr<SpectrumValue>
LteSpectrumValueHelper::CreateUlTxPowerSpectralDensity (uint16_t earfcn, uint8_t txBandwidthConfiguration, double powerTx, std::vector <int> activeRbs)
{
NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << powerTx << activeRbs);
Ptr<SpectrumModel> model = GetSpectrumModel (earfcn, txBandwidthConfiguration);
Ptr<SpectrumValue> txPsd = Create <SpectrumValue> (model);
// powerTx is expressed in dBm. We must convert it into natural unit.
double powerTxW = std::pow (10., (powerTx - 30) / 10);
double txPowerDensity = (powerTxW / (activeRbs.size() * 180000));
for (std::vector <int>::iterator it = activeRbs.begin (); it != activeRbs.end (); it++)
{
int rbId = (*it);
(*txPsd)[rbId] = txPowerDensity;
}
NS_LOG_LOGIC (*txPsd);
return txPsd;
}
Ptr<SpectrumValue>
LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint32_t earfcn, uint8_t txBandwidthConfiguration, double noiseFigure)

View File

@@ -152,6 +152,23 @@ public:
std::map<int, double> powerTxMap,
std::vector <int> activeRbs);
/**
* create a spectrum value representing the uplink power spectral
* density of a signal to be transmitted. See 3GPP TS 36.101 for
* a definition of most of the parameters described here.
* This function splits the power over the active RBs instead of
* the entire bandwidth
* \param earfcn the carrier frequency (EARFCN) of the transmission
* \param powerTx the total power in dBm over the whole bandwidth
* \param activeRbs the list of Active Resource Blocks (PRBs)
*
* \return a pointer to a newly allocated SpectrumValue representing the TX Power Spectral Density in W/Hz for each Resource Block
*/
static Ptr<SpectrumValue> CreateUlTxPowerSpectralDensity (uint16_t earfcn,
uint8_t bandwidth,
double powerTx,
std::vector <int> activeRbs);
/**
* create a SpectrumValue that models the power spectral density of AWGN
*

View File

@@ -468,7 +468,7 @@ LteUePhy::CreateTxPowerSpectralDensity ()
{
NS_LOG_FUNCTION (this);
LteSpectrumValueHelper psdHelper;
Ptr<SpectrumValue> psd = psdHelper.CreateTxPowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_txPower, GetSubChannelsForTransmission ());
Ptr<SpectrumValue> psd = psdHelper.CreateUlTxPowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_txPower, GetSubChannelsForTransmission ());
return psd;
}

View File

@@ -524,9 +524,28 @@ LteFrAreaTestCase::UlDataRxStart (Ptr<const SpectrumValue> spectrumValue)
NS_LOG_DEBUG ("UL DATA Power allocation :");
Values::const_iterator it;
uint32_t i = 0;
uint32_t numActiveRbs = 0;
// At the moment I could not find a better way to find total number
// of active RBs. This method is independent of the bandwidth
// configuration done in a test scenario, thus, it requires
// minimum change to the script.
for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
{
double power = (*it) * (m_ulBandwidth * 180000);
// Count the RB as active if it is part of
// the expected UL RBs and has Power Spectral Density (PSD) > 0
if (m_expectedUlRb[numActiveRbs] == true && (*it) > 0)
{
numActiveRbs++;
}
}
NS_LOG_DEBUG ("Total number of active RBs = " << numActiveRbs);
// The uplink power control and the uplink PSD
// calculation only consider active resource blocks.
for (it = spectrumValue->ConstValuesBegin (); it != spectrumValue->ConstValuesEnd (); it++)
{
double power = (*it) * (numActiveRbs * 180000);
NS_LOG_DEBUG ("RB " << i << " POWER: " << power << " expectedUlPower: " << m_expectedUlPower);
if (m_expectedUlRb[i] == false && power > 0)
{