merge
This commit is contained in:
@@ -248,6 +248,7 @@ main (int argc, char *argv[])
|
||||
bool epcUl = true;
|
||||
bool useUdp = true;
|
||||
bool generateRem = false;
|
||||
std::string fadingFileTrace = "";
|
||||
|
||||
CommandLine cmd;
|
||||
cmd.AddValue ("nBlocks", "Number of femtocell blocks", nBlocks);
|
||||
@@ -287,6 +288,7 @@ main (int argc, char *argv[])
|
||||
cmd.AddValue ("useUdp", "if true, the UdpClient application will be used. "
|
||||
"Otherwise, the BulkSend application will be used over a TCP connection. "
|
||||
"If EPC is not used, this parameter will be ignored.", useUdp);
|
||||
cmd.AddValue ("fadingTrace", "The path of the fading trace (by default any fading trace is loadedm which implies that fading is not considered)", fadingFileTrace);
|
||||
|
||||
|
||||
cmd.Parse (argc, argv);
|
||||
@@ -356,6 +358,12 @@ main (int argc, char *argv[])
|
||||
// use always LOS model
|
||||
lteHelper->SetPathlossModelAttribute ("Los2NlosThr", DoubleValue (1e6));
|
||||
lteHelper->SetSpectrumChannelType ("ns3::MultiModelSpectrumChannel");
|
||||
|
||||
if (!fadingFileTrace.empty ())
|
||||
{
|
||||
lteHelper->SetAttribute ("FadingModel", StringValue ("ns3::TraceFadingLossModel"));
|
||||
lteHelper->SetFadingModelAttribute("TraceFilename", StringValue (fadingFileTrace));
|
||||
}
|
||||
|
||||
Ptr<EpcHelper> epcHelper;
|
||||
if (epc)
|
||||
@@ -417,13 +425,18 @@ main (int argc, char *argv[])
|
||||
NetDeviceContainer homeUeDevs = lteHelper->InstallUeDevice (homeUes);
|
||||
|
||||
NetDeviceContainer::Iterator ueDevIt;
|
||||
NetDeviceContainer::Iterator enbDevIt;
|
||||
NetDeviceContainer::Iterator enbDevIt = homeEnbDevs.Begin ();
|
||||
// attach explicitly each home UE to its home eNB
|
||||
for (ueDevIt = homeUeDevs.Begin (),
|
||||
enbDevIt = homeEnbDevs.Begin ();
|
||||
ueDevIt != homeUeDevs.End () && enbDevIt != homeEnbDevs.End ();
|
||||
for (ueDevIt = homeUeDevs.Begin ();
|
||||
ueDevIt != homeUeDevs.End ();
|
||||
++ueDevIt, ++enbDevIt)
|
||||
{
|
||||
// this because of the order in which SameRoomPositionAllocator
|
||||
// will place the UEs
|
||||
if (enbDevIt == homeEnbDevs.End ())
|
||||
{
|
||||
enbDevIt = homeEnbDevs.Begin ();
|
||||
}
|
||||
lteHelper->Attach (*ueDevIt, *enbDevIt);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,14 +46,14 @@ main (int argc, char *argv[])
|
||||
uint16_t numberOfNodes = 2;
|
||||
double simTime = 5.0;
|
||||
double distance = 60.0;
|
||||
// Inter packet interval in ms
|
||||
// double interPacketInterval = 1;
|
||||
double interPacketInterval = 100;
|
||||
|
||||
// Command line arguments
|
||||
CommandLine cmd;
|
||||
cmd.AddValue("numberOfNodes", "Number of eNodeBs + UE pairs", numberOfNodes);
|
||||
cmd.AddValue("simTime", "Total duration of the simulation (in seconds)",simTime);
|
||||
cmd.AddValue("simTime", "Total duration of the simulation [s])", simTime);
|
||||
cmd.AddValue("distance", "Distance between eNBs [m]", distance);
|
||||
cmd.AddValue("interPacketInterval", "Inter packet interval [ms])", interPacketInterval);
|
||||
cmd.Parse(argc, argv);
|
||||
|
||||
Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
|
||||
|
||||
@@ -101,10 +101,11 @@ LteHelper::DoStart (void)
|
||||
NS_ASSERT_MSG (ulPlm != 0, " " << m_uplinkPathlossModel << " is neither PropagationLossModel nor SpectrumPropagationLossModel");
|
||||
m_uplinkChannel->AddPropagationLossModel (ulPlm);
|
||||
}
|
||||
|
||||
if (m_fadingModelType.compare ( "ns3::TraceFadingLossModel") == 0)
|
||||
if (!m_fadingModelType.empty ())
|
||||
{
|
||||
m_fadingModule = m_fadingModelFactory.Create<TraceFadingLossModel> ();
|
||||
Ptr<SpectrumPropagationLossModel> m_fadingModule;
|
||||
m_fadingModule = m_fadingModelFactory.Create<SpectrumPropagationLossModel> ();
|
||||
m_fadingModule->Start ();
|
||||
m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
|
||||
m_uplinkChannel->AddSpectrumPropagationLossModel (m_fadingModule);
|
||||
}
|
||||
@@ -482,18 +483,7 @@ LteHelper::Attach (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice)
|
||||
Ptr<LteUePhy> uePhy = ueDevice->GetObject<LteUeNetDevice> ()->GetPhy ();
|
||||
enbPhy->AddUePhy (rnti, uePhy);
|
||||
|
||||
if (m_fadingModelType.compare ( "ns3::TraceFadingLossModel") == 0)
|
||||
{
|
||||
Ptr<MobilityModel> mm_enb_dl = enbPhy->GetDownlinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_ue_ul = uePhy->GetUplinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_enb_ul = enbPhy->GetUplinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
Ptr<MobilityModel> mm_ue_dl = uePhy->GetDownlinkSpectrumPhy ()->GetMobility ()->GetObject<MobilityModel> ();
|
||||
|
||||
m_fadingModule->CreateFadingChannelRealization (mm_enb_dl, mm_ue_dl); //downlink eNB -> UE
|
||||
m_fadingModule->CreateFadingChannelRealization (mm_ue_ul, mm_enb_ul); //uplink UE -> eNB
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// WILD HACK - should be done through PHY SAP, probably passing by RRC
|
||||
uePhy->SetRnti (rnti);
|
||||
uePhy->DoSetBandwidth (enbDevice->GetObject<LteEnbNetDevice> ()->GetUlBandwidth (),
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <ns3/mac-stats-calculator.h>
|
||||
#include <ns3/radio-bearer-stats-calculator.h>
|
||||
#include <ns3/epc-tft.h>
|
||||
#include <ns3/trace-fading-loss-model.h>
|
||||
#include <ns3/mobility-model.h>
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -340,8 +340,6 @@ private:
|
||||
std::string m_fadingModelType;
|
||||
ObjectFactory m_fadingModelFactory;
|
||||
|
||||
Ptr<TraceFadingLossModel> m_fadingModule;
|
||||
|
||||
Ptr<MacStatsCalculator> m_macStats;
|
||||
Ptr<RadioBearerStatsCalculator> m_rlcStats;
|
||||
Ptr<RadioBearerStatsCalculator> m_pdcpStats;
|
||||
|
||||
@@ -579,8 +579,10 @@ LteEnbMac::DoReceivePhyPdu (Ptr<Packet> p)
|
||||
// new RNTI
|
||||
UlInfoListElement_s ulinfonew;
|
||||
ulinfonew.m_rnti = tag.GetRnti ();
|
||||
std::vector <uint16_t>::iterator it = ulinfonew.m_ulReception.begin ();
|
||||
ulinfonew.m_ulReception.insert (it + (tag.GetLcid () - 1), p->GetSize ());
|
||||
// always allocate full size of ulReception vector, initializing all elements to 0
|
||||
ulinfonew.m_ulReception.assign (MAX_LC_LIST+1, 0);
|
||||
// set the element for the current LCID
|
||||
ulinfonew.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
|
||||
ulinfonew.m_receptionStatus = UlInfoListElement_s::Ok;
|
||||
ulinfonew.m_tpc = 0; // Tx power control not implemented at this stage
|
||||
m_ulInfoListElements.insert (std::pair<uint16_t, UlInfoListElement_s > (tag.GetRnti (), ulinfonew));
|
||||
@@ -588,15 +590,11 @@ LteEnbMac::DoReceivePhyPdu (Ptr<Packet> p)
|
||||
}
|
||||
else
|
||||
{
|
||||
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 ();
|
||||
}
|
||||
// existing RNTI: we just set the value for the current
|
||||
// LCID. Note that the corresponding element had already been
|
||||
// allocated previously.
|
||||
NS_ASSERT_MSG ((*it).second.m_ulReception.at (tag.GetLcid ()) == 0, "would overwrite previously written ulReception element");
|
||||
(*it).second.m_ulReception.at (tag.GetLcid ()) = p->GetSize ();
|
||||
(*it).second.m_receptionStatus = UlInfoListElement_s::Ok;
|
||||
}
|
||||
|
||||
|
||||
@@ -292,16 +292,22 @@ LteUeMac::SendReportBufferStatus (void)
|
||||
MacCeListElement_s bsr;
|
||||
bsr.m_rnti = m_rnti;
|
||||
bsr.m_macCeType = MacCeListElement_s::BSR;
|
||||
// BSR
|
||||
std::map <uint8_t, uint64_t>::iterator it;
|
||||
NS_ASSERT_MSG (m_ulBsrReceived.size () <=4, " Too many LCs (max is 4)");
|
||||
|
||||
|
||||
// BSR is reported for each LCG. As a simplification, we consider that all LCs belong to the first LCG.
|
||||
std::map <uint8_t, uint64_t>::iterator it;
|
||||
int queue = 0;
|
||||
for (it = m_ulBsrReceived.begin (); it != m_ulBsrReceived.end (); it++)
|
||||
{
|
||||
int queue = (*it).second;
|
||||
int index = BufferSizeLevelBsr::BufferSize2BsrId (queue);
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (index);
|
||||
queue += (*it).second;
|
||||
|
||||
}
|
||||
int index = BufferSizeLevelBsr::BufferSize2BsrId (queue);
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (index);
|
||||
// FF API says that all 4 LCGs are always present
|
||||
// we do so but reporting a 0 size for all other LCGs
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
|
||||
bsr.m_macCeValue.m_bufferStatus.push_back (BufferSizeLevelBsr::BufferSize2BsrId (0));
|
||||
|
||||
// create the feedback to eNB
|
||||
Ptr<BsrIdealControlMessage> msg = Create<BsrIdealControlMessage> ();
|
||||
|
||||
@@ -1025,6 +1025,8 @@ PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
|
||||
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
|
||||
{
|
||||
// buffer status report
|
||||
// note that we only consider LCG 0, the other three LCGs are neglected
|
||||
// this is consistent with the assumption in LteUeMac that the first LCG gathers all LCs
|
||||
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
|
||||
it = m_ceBsrRxed.find (rnti);
|
||||
if (it == m_ceBsrRxed.end ())
|
||||
@@ -1032,11 +1034,11 @@ PfFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
|
||||
// create the new entry
|
||||
uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
|
||||
int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
|
||||
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); // only 1 buffer status is working now
|
||||
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
// update the CQI value
|
||||
// update the buffer size value
|
||||
(*it).second = BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -827,6 +827,8 @@ RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
|
||||
if ( params.m_macCeList.at (i).m_macCeType == MacCeListElement_s::BSR )
|
||||
{
|
||||
// buffer status report
|
||||
// note that we only consider LCG 0, the other three LCGs are neglected
|
||||
// this is consistent with the assumption in LteUeMac that the first LCG gathers all LCs
|
||||
uint16_t rnti = params.m_macCeList.at (i).m_rnti;
|
||||
it = m_ceBsrRxed.find (rnti);
|
||||
if (it == m_ceBsrRxed.end ())
|
||||
@@ -834,13 +836,12 @@ RrFfMacScheduler::DoSchedUlMacCtrlInfoReq (const struct FfMacSchedSapProvider::S
|
||||
// create the new entry
|
||||
uint8_t bsrId = params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0);
|
||||
int buffer = BufferSizeLevelBsr::BsrId2BufferSize (bsrId);
|
||||
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer)); // only 1 buffer status is working now
|
||||
m_ceBsrRxed.insert ( std::pair<uint16_t, uint32_t > (rnti, buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
// update the CQI value
|
||||
// update the buffer size value
|
||||
(*it).second = BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0));
|
||||
// NS_LOG_DEBUG (this << " Update BSR with " << BufferSizeLevelBsr::BsrId2BufferSize (params.m_macCeList.at (i).m_macCeValue.m_bufferStatus.at (0)) << " at " << Simulator::Now ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +109,13 @@ TraceFadingLossModel::SetTraceLength (Time t)
|
||||
m_traceLength = t;
|
||||
}
|
||||
|
||||
void
|
||||
TraceFadingLossModel::DoStart ()
|
||||
{
|
||||
LoadTrace ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TraceFadingLossModel::LoadTrace ()
|
||||
{
|
||||
@@ -136,6 +143,7 @@ TraceFadingLossModel::LoadTrace ()
|
||||
m_fadingTrace.push_back (rbTimeFadingTrace);
|
||||
}
|
||||
m_timeGranularity = m_traceLength.GetMilliSeconds () / m_samplesNum;
|
||||
m_lastWindowUpdate = Simulator::Now ();
|
||||
}
|
||||
|
||||
|
||||
@@ -150,15 +158,26 @@ TraceFadingLossModel::DoCalcRxPowerSpectralDensity (
|
||||
std::map <ChannelRealizationId_t, int >::iterator itOff;
|
||||
ChannelRealizationId_t mobilityPair = std::make_pair (a,b);
|
||||
itOff = m_windowOffsetsMap.find (mobilityPair);
|
||||
if (Simulator::Now ().GetSeconds () >= m_lastWindowUpdate.GetSeconds () + m_windowSize.GetSeconds ())
|
||||
if (itOff!=m_windowOffsetsMap.end ())
|
||||
{
|
||||
NS_LOG_INFO ("Fading Window Updated");
|
||||
std::map <ChannelRealizationId_t, UniformVariable* >::iterator itVar;
|
||||
if (Simulator::Now ().GetSeconds () >= m_lastWindowUpdate.GetSeconds () + m_windowSize.GetSeconds ())
|
||||
{
|
||||
NS_LOG_INFO ("Fading Window Updated");
|
||||
std::map <ChannelRealizationId_t, UniformVariable* >::iterator itVar;
|
||||
|
||||
itVar = m_startVariableMap.find (mobilityPair);
|
||||
(*itOff).second = (*itVar).second->GetValue ();
|
||||
itVar = m_startVariableMap.find (mobilityPair);
|
||||
(*itOff).second = (*itVar).second->GetValue ();
|
||||
|
||||
m_lastWindowUpdate = Simulator::Now ();
|
||||
m_lastWindowUpdate = Simulator::Now ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_LOG_LOGIC (this << "insert new channel realization, m_windowOffsetMap.size () = " << m_windowOffsetsMap.size ());
|
||||
UniformVariable* startV = new UniformVariable (1, (m_traceLength.GetSeconds () - m_windowSize.GetSeconds ()) * 1000.0);
|
||||
ChannelRealizationId_t mobilityPair = std::make_pair (a,b);
|
||||
m_startVariableMap.insert (std::pair<ChannelRealizationId_t,UniformVariable* > (mobilityPair, startV));
|
||||
m_windowOffsetsMap.insert (std::pair<ChannelRealizationId_t,int> (mobilityPair, startV->GetValue ()));
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +190,7 @@ TraceFadingLossModel::DoCalcRxPowerSpectralDensity (
|
||||
//double speed = sqrt (pow (aSpeedVector.x-bSpeedVector.x,2) + pow (aSpeedVector.y-bSpeedVector.y,2));
|
||||
|
||||
NS_LOG_LOGIC (this << *rxPsd);
|
||||
|
||||
NS_ASSERT (!m_fadingTrace.empty ());
|
||||
int now_ms = static_cast<int> (Simulator::Now ().GetMilliSeconds () * m_timeGranularity);
|
||||
int lastUpdate_ms = static_cast<int> (m_lastWindowUpdate.GetMilliSeconds () * m_timeGranularity);
|
||||
int index = (*itOff).second + now_ms - lastUpdate_ms;
|
||||
@@ -204,24 +223,5 @@ TraceFadingLossModel::DoCalcRxPowerSpectralDensity (
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TraceFadingLossModel::CreateFadingChannelRealization (Ptr<const MobilityModel> enbMobility, Ptr<const MobilityModel> ueMobility)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << enbMobility << ueMobility);
|
||||
|
||||
if (m_fadingTrace.empty ())
|
||||
{
|
||||
TraceFadingLossModel::LoadTrace ();
|
||||
m_lastWindowUpdate = Simulator::Now ();
|
||||
}
|
||||
|
||||
NS_LOG_LOGIC (this << "insert new channel realization, m_windowOffsetMap.size () = " << m_windowOffsetsMap.size ());
|
||||
UniformVariable* startV = new UniformVariable (1, (m_traceLength.GetSeconds () - m_windowSize.GetSeconds ()) * 1000.0);
|
||||
ChannelRealizationId_t mobilityPair = std::make_pair (enbMobility,ueMobility);
|
||||
m_startVariableMap.insert (std::pair<ChannelRealizationId_t,UniformVariable* > (mobilityPair, startV));
|
||||
m_windowOffsetsMap.insert (std::pair<ChannelRealizationId_t,int> (mobilityPair, startV->GetValue ()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -48,19 +48,14 @@ public:
|
||||
virtual ~TraceFadingLossModel ();
|
||||
|
||||
static TypeId GetTypeId ();
|
||||
|
||||
virtual void DoStart (void);
|
||||
|
||||
/**
|
||||
* \brief The couple of mobility mnode that form a fading channel realization
|
||||
*/
|
||||
typedef std::pair<Ptr<const MobilityModel>, Ptr<const MobilityModel> > ChannelRealizationId_t;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Create a fading channel realization among two device
|
||||
* \param enbMobility mobility object of the enb
|
||||
* \param ueMobility mobility object of the ue
|
||||
*/
|
||||
void CreateFadingChannelRealization (Ptr<const MobilityModel> enbMobility, Ptr<const MobilityModel> ueMobility);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
@@ -13,6 +13,8 @@ cpp_examples = [
|
||||
("lena-dual-stripe --simTime=0.01", "True", "True"),
|
||||
("lena-dual-stripe --epc=1 --simTime=0.01", "True", "True"),
|
||||
("lena-dual-stripe --epc=1 --useUdp=0 --simTime=0.01", "True", "True"),
|
||||
("lena-dual-stripe --epc=1 --fadingTrace=../../src/lte/model/fading-traces/fading_trace_EPA_3kmph.fad --simTime=0.01", "True", "True"),
|
||||
("lena-dual-stripe --nBlocks=1 --nMacroEnbSites=0 --macroUeDensity=0 --homeEnbDeploymentRatio=1 --homeEnbActivationRatio=1 --homeUesHomeEnbRatio=2 --macroEnbTxPowerDbm=0 --simTime=0.01", "True", "True"),
|
||||
("lena-fading", "True", "True"),
|
||||
("lena-gtpu-tunnel", "True", "True"),
|
||||
("lena-intercell-interference", "True", "True"),
|
||||
|
||||
@@ -59,7 +59,7 @@ class Packet;
|
||||
*
|
||||
* If you want to write a new MAC layer, you need to subclass
|
||||
* this base class and implement your own version of the
|
||||
* NetDevice::SendTo method.
|
||||
* pure virtual methods in this class.
|
||||
*
|
||||
* This class was designed to hide as many MAC-level details as
|
||||
* possible from the perspective of layer 3 to allow a single layer 3
|
||||
|
||||
Reference in New Issue
Block a user