merge traces

This commit is contained in:
Manuel Requena
2011-11-29 16:30:11 +01:00
13 changed files with 151 additions and 34 deletions

View File

@@ -203,6 +203,7 @@ BuildingsPathlossTestCase::DoRun (void)
NS_LOG_INFO ("Theoretical loss: " << m_lossRef);
NS_TEST_ASSERT_MSG_EQ_TOL (loss, m_lossRef, 0.1, "Wrong loss !");
Simulator::Destroy ();
}
Ptr<MobilityModel>

View File

@@ -135,6 +135,7 @@ BuildingsShadowingTestCase::DoRun (void)
NS_LOG_INFO ("Mean from simulation " << mean << ", sigma " << sigma << ", reference value " << m_sigmaRef << ", CI(99%) " << ci);
NS_TEST_ASSERT_MSG_EQ_TOL (fabs (mean), 0.0, ci, "Wrong shadowing distribution !");
Simulator::Destroy ();
}

View File

@@ -56,7 +56,7 @@ main (int argc, char *argv[])
Ptr<LenaHelper> lteHelper = CreateObject<LenaHelper> ();
Ptr<EpcHelper> epcHelper = CreateObject<EpcHelper> ();
lteHelper->SetEpcHelper (epcHelper);
//lteHelper->SetSchedulerType("ns3::RrFfMacScheduler");
lteHelper->SetSchedulerType("ns3::RrFfMacScheduler");
ConfigStore inputConfig;
inputConfig.ConfigureDefaults();

View File

@@ -539,8 +539,24 @@ LenaHelper::EnableLogComponents (void)
std::string propModelStr = m_dlPathlossModelFactory.GetTypeId ().GetName ().erase (0,5).c_str ();
const char* propModel = m_dlPathlossModelFactory.GetTypeId ().GetName ().erase (0,5).c_str ();
LogComponentEnable (propModel, LOG_LEVEL_ALL);
if (m_fadingModelType.compare ( "ns3::TraceFadingLossModel") == 0)
if (propModelStr.compare ("RandomPropagationLossModel") ||
propModelStr.compare ("FriisPropagationLossModel")||
propModelStr.compare ("TwoRayGroundPropagationLossModel")||
propModelStr.compare ("LogDistancePropagationLossModel")||
propModelStr.compare ("ThreeLogDistancePropagationLossModel")||
propModelStr.compare ("NakagamiPropagationLossModel")||
propModelStr.compare ("FixedRssLossModel")||
propModelStr.compare ("MatrixPropagationLossModel")||
propModelStr.compare ("RangePropagationLossModel"))
{
LogComponentEnable ("PropagationLossModel", LOG_LEVEL_ALL);
}
else
{
LogComponentEnable (propModel, LOG_LEVEL_ALL);
}
if (m_fadingModelType.compare ("ns3::TraceFadingLossModel") == 0)
{
const char* fadingModel = m_fadingModelType.erase (0,5).c_str ();
LogComponentEnable (fadingModel, LOG_LEVEL_ALL);

View File

@@ -538,7 +538,15 @@ LteEnbMac::DoReceivePhyPdu (Ptr<Packet> p)
}
else
{
(*it).second.m_ulReception.at (tag.GetLcid () - 1) += p->GetSize ();
if ((*it).second.m_ulReception.size () < tag.GetLcid ())
{
std::vector <uint16_t>::iterator itV = (*it).second.m_ulReception.begin ();
(*it).second.m_ulReception.insert (itV + (tag.GetLcid () - 1), p->GetSize ());
}
else
{
(*it).second.m_ulReception.at (tag.GetLcid () - 1) += p->GetSize ();
}
(*it).second.m_receptionStatus = UlInfoListElement_s::Ok;
}

View File

@@ -397,8 +397,6 @@ LteEnbPhy::StartSubFrame (void)
}
// trigger the MAC
Ptr<LteEnbMac> macEntity = GetDevice ()->GetObject<LteEnbNetDevice> ()->GetMac ();
m_enbPhySapUser->SubframeIndication (m_nrFrames, m_nrSubFrames);

View File

@@ -31,6 +31,7 @@
#include "lte-mac-tag.h"
#include <ns3/ff-mac-common.h>
#include <ns3/ideal-control-messages.h>
#include <ns3/simulator.h>
NS_LOG_COMPONENT_DEFINE ("LteUeMac");
@@ -161,7 +162,7 @@ UeMemberLteUePhySapUser::ReceivePhyPdu (Ptr<Packet> p)
void
UeMemberLteUePhySapUser::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
NS_LOG_LOGIC (this << " UE-MAC does not yet support this primitive");
m_mac->DoSubframeIndication (frameNo, subframeNo);
}
void
@@ -189,6 +190,9 @@ LteUeMac::GetTypeId (void)
LteUeMac::LteUeMac ()
: m_bsrPeriodicity (MilliSeconds (1)), // ideal behavior
m_bsrLast (MilliSeconds (0))
{
NS_LOG_FUNCTION (this);
m_macSapProvider = new UeMemberLteMacSapProvider (this);
@@ -263,24 +267,51 @@ void
LteUeMac::DoReportBufferStatus (LteMacSapProvider::ReportBufferStatusParameters params)
{
NS_LOG_FUNCTION (this);
MacCeListElement_s bsr;
bsr.m_rnti = m_rnti;
bsr.m_macCeType = MacCeListElement_s::BSR;
// short BSR
int queue = params.txQueueSize;
int index = 0;
if (BufferSizeLevelBsr[63] < queue)
std::map <uint8_t, long uint>::iterator it;
it = m_ulBsrReceived.find (params.lcid);
if (it!=m_ulBsrReceived.end ())
{
index = 63;
// update entry
(*it).second = params.txQueueSize + params.retxQueueSize + params.statusPduSize;
}
else
{
while (BufferSizeLevelBsr[index] < queue)
{
index++;
}
m_ulBsrReceived.insert (std::pair<uint8_t, long uint> (params.lcid, params.txQueueSize + params.retxQueueSize + params.statusPduSize));
}
}
void
LteUeMac::SendReportBufferStatus (void)
{
NS_LOG_FUNCTION (this);
MacCeListElement_s bsr;
bsr.m_rnti = m_rnti;
bsr.m_macCeType = MacCeListElement_s::BSR;
// BSR
std::map <uint8_t, long uint>::iterator it;
NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
for (it = m_ulBsrReceived.begin (); it != m_ulBsrReceived.end (); it++)
{
int queue = (*it).second;
int index = 0;
if (BufferSizeLevelBsr[63] < queue)
{
index = 63;
}
else
{
while (BufferSizeLevelBsr[index] < queue)
{
index++;
}
}
bsr.m_macCeValue.m_bufferStatus.push_back (index);
}
bsr.m_macCeValue.m_bufferStatus.push_back (index);
// create the feedback to eNB
Ptr<BsrIdealControlMessage> msg = Create<BsrIdealControlMessage> ();
@@ -336,9 +367,33 @@ LteUeMac::DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
{
Ptr<UlDciIdealControlMessage> msg2 = DynamicCast<UlDciIdealControlMessage> (msg);
UlDciListElement_s dci = msg2->GetDci ();
std::map <uint8_t, LteMacSapUser*>::iterator it;
it = m_macSapUserMap.begin (); // use only the first LC --> UE-SCHEDULER??
(*it).second->NotifyTxOpportunity (dci.m_tbSize);
std::map <uint8_t, long uint>::iterator itBsr;
NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
int activeLcs = 0;
for (itBsr = m_ulBsrReceived.begin (); itBsr != m_ulBsrReceived.end (); itBsr++)
{
if ((*itBsr).second > 0)
{
activeLcs++;
}
}
if (activeLcs <= 0)
{
NS_LOG_ERROR (this << " No active flows for this UL-DCI");
return;
}
std::map <uint8_t, LteMacSapUser*>::iterator it;
NS_LOG_FUNCTION (this << " UE: UL-CQI notified TxOpportunity of " << dci.m_tbSize);
for (it = m_macSapUserMap.begin (); it!=m_macSapUserMap.end (); it++)
{
itBsr = m_ulBsrReceived.find ((*it).first);
if (itBsr!=m_ulBsrReceived.end ())
{
NS_LOG_FUNCTION (this << "\t" << dci.m_tbSize / m_macSapUserMap.size () << " bytes to LC " << (uint16_t)(*it).first << " queue " << (*itBsr).second);
(*it).second->NotifyTxOpportunity (dci.m_tbSize / activeLcs);
(*itBsr).second -= dci.m_tbSize / activeLcs;
}
}
}
else
@@ -348,4 +403,16 @@ LteUeMac::DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
}
void
LteUeMac::DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
NS_LOG_FUNCTION (this);
if (Simulator::Now () >= m_bsrLast + m_bsrPeriodicity)
{
SendReportBufferStatus ();
m_bsrLast = Simulator::Now ();
}
}
} // namespace ns3

View File

@@ -29,6 +29,7 @@
#include <ns3/lte-mac-sap.h>
#include <ns3/lte-ue-cmac-sap.h>
#include <ns3/lte-ue-phy-sap.h>
#include <ns3/nstime.h>
namespace ns3 {
@@ -62,6 +63,14 @@ public:
* \param s a pointer to the PHY SAP Provider
*/
void SetLteUePhySapProvider (LteUePhySapProvider* s);
/**
* \brief Forwarded from LteUePhySapUser: trigger the start from a new frame
*
* \param frameNo frame number
* \param subframeNo subframe number
*/
void DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo);
private:
// forwarded from MAC SAP
@@ -76,6 +85,8 @@ private:
// forwarded from PHY SAP
void DoReceivePhyPdu (Ptr<Packet> p);
void DoReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
void SendReportBufferStatus (void);
private:
// end of temporary hack
@@ -87,6 +98,11 @@ private:
LteUePhySapProvider* m_uePhySapProvider;
LteUePhySapUser* m_uePhySapUser;
std::map <uint8_t, long uint> m_ulBsrReceived; // BSR received from RLC (BSR up to now)
Time m_bsrPeriodicity;
Time m_bsrLast;
uint16_t m_rnti;

View File

@@ -491,6 +491,9 @@ LteUePhy::SubframeIndication (uint32_t frameNo, uint32_t subframeNo)
{
m_uplinkSpectrumPhy->StartTx (pb);
}
// trigger the MAC
m_uePhySapUser->SubframeIndication (frameNo, subframeNo);
}

View File

@@ -321,16 +321,20 @@ RrFfMacScheduler::DoSchedDlRlcBufferReq (const struct FfMacSchedSapProvider::Sch
{
NS_LOG_FUNCTION (this << params.m_rnti << (uint32_t) params.m_logicalChannelIdentity);
// API generated by RLC for updating RLC parameters on a LC (tx and retx queues)
std::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it;
std::list<FfMacSchedSapProvider::SchedDlRlcBufferReqParameters>::iterator it = m_rlcBufferReq.begin ();
bool newLc = true;
for (it = m_rlcBufferReq.begin (); it != m_rlcBufferReq.end (); it++)
while (it != m_rlcBufferReq.end ())
{
// remove old entries of this UE-LC
if (((*it).m_rnti == params.m_rnti)&&((*it).m_logicalChannelIdentity == params.m_logicalChannelIdentity))
{
m_rlcBufferReq.erase (it);
it = m_rlcBufferReq.erase (it);
newLc = false;
}
else
{
++it;
}
}
// add the new parameters
m_rlcBufferReq.insert (it, params);

View File

@@ -252,7 +252,6 @@ LteDownlinkSinrTestCase::DoRun (void)
Simulator::Stop (Seconds (5.0));
Simulator::Run ();
Simulator::Destroy ();
/**
* Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
@@ -264,4 +263,6 @@ LteDownlinkSinrTestCase::DoRun (void)
NS_LOG_INFO ("Calculated SINR: " << calculatedSinr);
NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL(calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
dlPhy->Dispose ();
Simulator::Destroy ();
}

View File

@@ -113,7 +113,7 @@ void
LteInterferenceTestCase::DoRun (void)
{
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
// lena->EnableLogComponents ();
// lena->EnableLogComponents ();
lena->EnableMacTraces ();
lena->EnableRlcTraces ();
lena->SetAttribute ("PathlossModel", StringValue ("ns3::FriisSpectrumPropagationLossModel"));
@@ -163,7 +163,6 @@ LteInterferenceTestCase::DoRun (void)
lena->ActivateEpsBearer (ueDevs1, bearer, LteTft::Default ());
lena->ActivateEpsBearer (ueDevs2, bearer, LteTft::Default ());
// Use testing chunk processor in the PHY layer
// It will be used to test that the SNR is as intended
// we plug in two instances, one for DL and one for UL
@@ -200,8 +199,9 @@ LteInterferenceTestCase::DoRun (void)
MakeBoundCallback (&LteTestUlSchedulingCallback, this));
Simulator::Stop (Seconds (0.005));
Simulator::Stop (Seconds (0.006));
Simulator::Run ();
double dlSinr1Db = 10.0 * log10 (testDlSinr1->GetSinr ()[0]);
NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr1Db, m_dlSinrDb, 0.01, "Wrong SINR in DL! (eNB1 --> UE1)");
@@ -211,7 +211,7 @@ LteInterferenceTestCase::DoRun (void)
double dlSinr2Db = 10.0 * log10 (testDlSinr2->GetSinr ()[0]);
NS_TEST_ASSERT_MSG_EQ_TOL (dlSinr2Db, m_dlSinrDb, 0.01, "Wrong SINR in DL! (eNB2 --> UE2)");
double ulSinr2Db = 10.0 * log10 (testUlSinr2->GetSinr ()[0]);
NS_TEST_ASSERT_MSG_EQ_TOL (ulSinr2Db, m_ulSinrDb, 0.01, "Wrong SINR in UL! (UE2 --> eNB2)");
@@ -241,10 +241,10 @@ LteInterferenceTestCase::UlScheduling (uint32_t frameNo, uint32_t subframeNo, ui
{
/**
* Note:
* For first 4 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
* For first 5 subframeNo in the first frameNo, the MCS cannot be properly evaluated,
* because CQI feedback is still not available at the eNB.
*/
if ( (frameNo > 1) || (subframeNo > 4) )
if ( (frameNo > 1) || (subframeNo > 5) )
{
NS_TEST_ASSERT_MSG_EQ ((uint16_t)mcs, m_ulMcs, "Wrong UL MCS");
}

View File

@@ -292,7 +292,6 @@ LteUplinkSinrTestCase::DoRun (void)
Simulator::Stop (Seconds (5.0));
Simulator::Run ();
Simulator::Destroy ();
/**
* Check that the values passed to LteSinrChunkProcessor::EvaluateSinrChunk () correspond
@@ -304,4 +303,7 @@ LteUplinkSinrTestCase::DoRun (void)
NS_LOG_INFO ("Calculated SINR: " << calculatedSinr);
NS_TEST_ASSERT_MSG_SPECTRUM_VALUE_EQ_TOL (calculatedSinr, *m_sinr, 0.0000001, "Wrong SINR !");
ulPhy->Dispose ();
Simulator::Destroy ();
}