--- a/src/lte/helper/lte-helper.cc Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/helper/lte-helper.cc Tue Nov 13 17:54:50 2012 +0100
@@ -441,6 +441,9 @@
ulPhy->SetHarqPhyModule (harq);
phy->SetHarqPhyModule (harq);
+ Ptr<LteRsReceivedPowerChunkProcessor> pRs = Create<LteRsReceivedPowerChunkProcessor> (phy->GetObject<LtePhy> ());
+ dlPhy->AddRsPowerChunkProcessor (pRs);
+
Ptr<LteCtrlSinrChunkProcessor> pCtrl = Create<LteCtrlSinrChunkProcessor> (phy->GetObject<LtePhy> (), dlPhy);
dlPhy->AddCtrlSinrChunkProcessor (pCtrl);
--- a/src/lte/model/lte-enb-phy.cc Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-enb-phy.cc Tue Nov 13 17:54:50 2012 +0100
@@ -651,6 +651,11 @@
}
}
+void
+LteEnbPhy::ReportRsReceivedPower (const SpectrumValue& power)
+{
+ // not used by eNB
+}
--- a/src/lte/model/lte-enb-phy.h Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-enb-phy.h Tue Nov 13 17:54:50 2012 +0100
@@ -231,6 +231,8 @@
virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
virtual void ReportInterference (const SpectrumValue& interf);
+ virtual void ReportRsReceivedPower (const SpectrumValue& interf);
+
/**
--- a/src/lte/model/lte-interference.cc Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-interference.cc Tue Nov 13 17:54:50 2012 +0100
@@ -46,7 +46,9 @@
LteInterference::DoDispose ()
{
NS_LOG_FUNCTION (this);
+ m_rsPowerChunkProcessorList.clear ();
m_sinrChunkProcessorList.clear ();
+ m_interfChunkProcessorList.clear ();
m_rxSignal = 0;
m_allSignals = 0;
m_noise = 0;
@@ -97,6 +99,10 @@
NS_LOG_FUNCTION (this);
ConditionallyEvaluateChunk ();
m_receiving = false;
+ for (std::list<Ptr<LteSinrChunkProcessor> >::const_iterator it = m_rsPowerChunkProcessorList.begin (); it != m_rsPowerChunkProcessorList.end (); ++it)
+ {
+ (*it)->End ();
+ }
for (std::list<Ptr<LteSinrChunkProcessor> >::const_iterator it = m_sinrChunkProcessorList.begin (); it != m_sinrChunkProcessorList.end (); ++it)
{
(*it)->End ();
@@ -162,6 +168,10 @@
{
(*it)->EvaluateSinrChunk (sinr, duration);
}
+ for (std::list<Ptr<LteSinrChunkProcessor> >::const_iterator it = m_rsPowerChunkProcessorList.begin (); it != m_rsPowerChunkProcessorList.end (); ++it)
+ {
+ (*it)->EvaluateSinrChunk (*m_rxSignal, duration);
+ }
for (std::list<Ptr<LteSinrChunkProcessor> >::const_iterator it = m_interfChunkProcessorList.begin (); it != m_interfChunkProcessorList.end (); ++it)
{
@@ -188,6 +198,13 @@
}
void
+LteInterference::AddRsPowerChunkProcessor (Ptr<LteSinrChunkProcessor> p)
+{
+ NS_LOG_FUNCTION (this << p);
+ m_rsPowerChunkProcessorList.push_back (p);
+}
+
+void
LteInterference::AddSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p)
{
NS_LOG_FUNCTION (this << p);
--- a/src/lte/model/lte-interference.h Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-interference.h Tue Nov 13 17:54:50 2012 +0100
@@ -72,6 +72,15 @@
void AddInterferenceChunkProcessor (Ptr<LteSinrChunkProcessor> p);
/**
+ * Add a LteSinrChunkProcessor that will use the time-vs-frequency
+ * power calculated by this LteInterference instance. Note
+ * that all the added LteSinrChunkProcessors will work in parallel.
+ *
+ * @param p
+ */
+ void AddRsPowerChunkProcessor (Ptr<LteSinrChunkProcessor> p);
+
+ /**
* notify that the PHY is starting a RX attempt
*
* @param rxPsd the power spectral density of the signal being RX
@@ -130,6 +139,10 @@
m_TotalPower */
/** all the processor instances that need to be notified whenever
+ a new interference chunk is calculated */
+ std::list<Ptr<LteSinrChunkProcessor> > m_rsPowerChunkProcessorList;
+
+ /** all the processor instances that need to be notified whenever
a new SINR chunk is calculated */
std::list<Ptr<LteSinrChunkProcessor> > m_sinrChunkProcessorList;
--- a/src/lte/model/lte-phy.h Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-phy.h Tue Nov 13 17:54:50 2012 +0100
@@ -205,7 +205,16 @@
*
* \param sinr the interference + noise power measured by the device
*/
- virtual void ReportInterference (const SpectrumValue& interf) = 0;
+ virtual void ReportInterference (const SpectrumValue& power) = 0;
+
+ /**
+ * generate a report based on the linear RS power perceived during CTRL
+ * frame
+ * NOTE: used only by UE for evaluating RSRP
+ *
+ * \param sinr the RS power measured by the device
+ */
+ virtual void ReportRsReceivedPower (const SpectrumValue& interf) = 0;
--- a/src/lte/model/lte-sinr-chunk-processor.cc Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-sinr-chunk-processor.cc Tue Nov 13 17:54:50 2012 +0100
@@ -169,6 +169,62 @@
}
+
+
+// ------------- LteRsReceivedPowerChunkProcessor ------------------------------
+
+LteRsReceivedPowerChunkProcessor::LteRsReceivedPowerChunkProcessor (Ptr<LtePhy> p)
+: m_phy (p)
+{
+ NS_LOG_FUNCTION (this << p);
+ NS_ASSERT (m_phy);
+}
+
+LteRsReceivedPowerChunkProcessor::~LteRsReceivedPowerChunkProcessor ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+
+void
+LteRsReceivedPowerChunkProcessor::Start ()
+{
+ NS_LOG_FUNCTION (this);
+ m_sumSinr = 0;
+ m_totDuration = MicroSeconds (0);
+}
+
+
+void
+LteRsReceivedPowerChunkProcessor::EvaluateSinrChunk (const SpectrumValue& sinr, Time duration)
+{
+ NS_LOG_FUNCTION (this << sinr << duration);
+ if (m_sumSinr == 0)
+ {
+ m_sumSinr = Create<SpectrumValue> (sinr.GetSpectrumModel ());
+ }
+ (*m_sumSinr) += sinr * duration.GetSeconds ();
+ m_totDuration += duration;
+}
+
+void
+LteRsReceivedPowerChunkProcessor::End ()
+{
+ NS_LOG_FUNCTION (this);
+ if (m_totDuration.GetSeconds () > 0)
+ {
+ m_phy->ReportRsReceivedPower ((*m_sumSinr) / m_totDuration.GetSeconds ());
+ }
+ else
+ {
+ NS_LOG_WARN ("m_numSinr == 0");
+ }
+}
+
+
+
+
+
// ------------- LteInterferencePowerChunkProcessor ------------------------------
LteInterferencePowerChunkProcessor::LteInterferencePowerChunkProcessor (Ptr<LtePhy> p)
--- a/src/lte/model/lte-sinr-chunk-processor.h Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-sinr-chunk-processor.h Tue Nov 13 17:54:50 2012 +0100
@@ -104,6 +104,29 @@
/**
+* The LteRsReceivedPowerChunkProcessor averages the received signal power
+* over time for data frame and therefore in charge of generating the
+* power linear values for generating the RSRP tracing at eNB side
+*
+*/
+class LteRsReceivedPowerChunkProcessor : public LteSinrChunkProcessor
+{
+ public:
+ virtual ~LteRsReceivedPowerChunkProcessor ();
+ LteRsReceivedPowerChunkProcessor (Ptr<LtePhy> p);
+ virtual void Start ();
+ virtual void EvaluateSinrChunk (const SpectrumValue& sinr, Time duration);
+ virtual void End ();
+ private:
+ Ptr<SpectrumValue> m_sumSinr;
+ Time m_totDuration;
+ Ptr<LtePhy> m_phy;
+};
+
+
+
+
+/**
* The LteInterferencePowerChunkProcessor averages the interference power
* over time for data frame and therefore in charge of generating the
* interference power linear values for generating the interference power
--- a/src/lte/model/lte-spectrum-phy.cc Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-spectrum-phy.cc Tue Nov 13 17:54:50 2012 +0100
@@ -1030,6 +1030,13 @@
void
+LteSpectrumPhy::AddRsPowerChunkProcessor (Ptr<LteSinrChunkProcessor> p)
+{
+ m_interferenceCtrl->AddRsPowerChunkProcessor (p);
+}
+
+
+void
LteSpectrumPhy::AddDataSinrChunkProcessor (Ptr<LteSinrChunkProcessor> p)
{
m_interferenceData->AddSinrChunkProcessor (p);
--- a/src/lte/model/lte-spectrum-phy.h Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-spectrum-phy.h Tue Nov 13 17:54:50 2012 +0100
@@ -303,6 +303,14 @@
void SetCellId (uint16_t cellId);
+ /**
+ *
+ *
+ * \param p the new LteSinrChunkProcessor to be added to the RS power
+ * \processing chain
+ */
+ void AddRsPowerChunkProcessor (Ptr<LteSinrChunkProcessor> p);
+
/**
*
*
--- a/src/lte/model/lte-ue-phy.cc Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-ue-phy.cc Tue Nov 13 17:54:50 2012 +0100
@@ -128,6 +128,7 @@
m_ueCphySapUser (0),
m_rnti (0),
m_srsPeriodicity (0),
+ m_rsReceivedPowerUpdated (false),
m_rsrpRsrqSampleCounter (0)
{
m_amc = CreateObject <LteAmc> ();
@@ -403,6 +404,14 @@
// Currently not used by UE
}
+void
+LteUePhy::ReportRsReceivedPower (const SpectrumValue& power)
+{
+ NS_LOG_FUNCTION (this << power);
+ m_rsReceivedPowerUpdated = true;
+ m_rsReceivedPower = power;
+}
+
Ptr<DlCqiLteControlMessage>
@@ -418,9 +427,26 @@
m_rsrpRsrqSampleCounter++;
if (m_rsrpRsrqSampleCounter==m_rsrpRsrqSamplePeriod)
{
- // Generate RSRP and RSRQ traces (dummy values, real valeus TBD)
- double rsrp = 0.0;
- double rsrq = 0.0;
+ NS_ASSERT_MSG (m_rsReceivedPowerUpdated, " RS received power info obsolete");
+ // RSRP evaluated as averaged received power among RBs
+ double sum = 0.0;
+ uint8_t rbNum = 0;
+ Values::const_iterator it;
+ for (it = m_rsReceivedPower.ConstValuesBegin (); it != m_rsReceivedPower.ConstValuesEnd (); it++)
+ {
+ sum += (*it);
+ rbNum++;
+ }
+ double rsrp = sum / (double)rbNum;
+ // RSRQ evaluated as averaged SINR among RBs
+ for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++)
+ {
+ sum += (*it);
+ rbNum++;
+ }
+ double rsrq = sum / (double)rbNum;
+ NS_LOG_INFO (this << " cellId " << m_cellId << " rnti " << m_rnti << " RSRP " << rsrp << " RSRQ " << rsrq);
+
m_reportCurrentCellRsrpRsrqTrace (m_cellId, m_rnti, rsrp, rsrq);
m_rsrpRsrqSampleCounter = 0;
}
@@ -625,7 +651,9 @@
LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
NS_LOG_FUNCTION (this << frameNo << subframeNo);
-
+
+ // refresh internal variables
+ m_rsReceivedPowerUpdated = false;
// update uplink transmission mask according to previous UL-CQIs
SetSubChannelsForTransmission (m_subChannelsForTransmissionQueue.at (0));
// shift the queue
--- a/src/lte/model/lte-ue-phy.h Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/model/lte-ue-phy.h Tue Nov 13 17:54:50 2012 +0100
@@ -169,6 +169,7 @@
virtual void GenerateCtrlCqiReport (const SpectrumValue& sinr);
virtual void GenerateDataCqiReport (const SpectrumValue& sinr);
virtual void ReportInterference (const SpectrumValue& interf);
+ virtual void ReportRsReceivedPower (const SpectrumValue& power);
virtual void DoSendLteControlMessage (Ptr<LteControlMessage> msg);
virtual void ReceiveLteControlMessageList (std::list<Ptr<LteControlMessage> >);
@@ -266,6 +267,9 @@
uint16_t m_srsPeriodicity;
uint16_t m_srsCounter;
+ bool m_rsReceivedPowerUpdated;
+ SpectrumValue m_rsReceivedPower;
+
Ptr<LteHarqPhy> m_harqPhyModule;
/**
--- a/src/lte/test/lte-test-ue-phy.cc Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/test/lte-test-ue-phy.cc Tue Nov 13 17:54:50 2012 +0100
@@ -96,6 +96,13 @@
}
void
+LteTestUePhy::ReportRsReceivedPower (const SpectrumValue& power)
+{
+ NS_LOG_FUNCTION (this);
+ // Not used by the LteTestUePhy
+}
+
+void
LteTestUePhy::ReportInterference (const SpectrumValue& interf)
{
NS_LOG_FUNCTION (this);
--- a/src/lte/test/lte-test-ue-phy.h Mon Nov 12 19:28:40 2012 +0100
+++ b/src/lte/test/lte-test-ue-phy.h Tue Nov 13 17:54:50 2012 +0100
@@ -64,6 +64,8 @@
virtual void ReportInterference (const SpectrumValue& interf);
+ virtual void ReportRsReceivedPower (const SpectrumValue& power);
+
virtual void ReceiveLteControlMessage (Ptr<LteControlMessage> msg);
SpectrumValue GetSinr ();