lte examples now passing valgrind tests
This commit is contained in:
@@ -66,11 +66,11 @@ int main (int argc, char *argv[])
|
||||
Ptr<EnbNetDevice> enb;
|
||||
enb = enbDevs.Get (0)->GetObject<EnbNetDevice> ();
|
||||
|
||||
Ptr<UeNetDevice> ue[nbUE];
|
||||
std::vector<Ptr<UeNetDevice> > ue (nbUE);
|
||||
for (int i = 0; i < nbUE; i++)
|
||||
{
|
||||
ue[i] = ueDevs.Get (i)->GetObject<UeNetDevice> ();
|
||||
lte.RegisterUeToTheEnb (ue[i], enb);
|
||||
ue.at (i) = ueDevs.Get (i)->GetObject<UeNetDevice> ();
|
||||
lte.RegisterUeToTheEnb (ue. at (i), enb);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ int main (int argc, char *argv[])
|
||||
|
||||
for (int i = 0; i < nbUE; i++)
|
||||
{
|
||||
ue[i]->GetPhy ()->SetDownlinkSubChannels (dlSubChannels);
|
||||
ue[i]->GetPhy ()->SetUplinkSubChannels (ulSubChannels);
|
||||
ue.at (i)->GetPhy ()->SetDownlinkSubChannels (dlSubChannels);
|
||||
ue.at (i)->GetPhy ()->SetUplinkSubChannels (ulSubChannels);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,9 +110,9 @@ int main (int argc, char *argv[])
|
||||
ueMobility->SetPosition (Vector (30.0, 0.0, 0.0));
|
||||
ueMobility->SetVelocity (Vector (30.0, 0.0, 0.0));
|
||||
|
||||
lte.AddMobility (ue[i]->GetPhy (), ueMobility);
|
||||
lte.AddMobility (ue.at (i)->GetPhy (), ueMobility);
|
||||
|
||||
lte.AddDownlinkChannelRealization (enbMobility, ueMobility, ue[i]->GetPhy ());
|
||||
lte.AddDownlinkChannelRealization (enbMobility, ueMobility, ue.at (i)->GetPhy ());
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
enb->GetRrcEntity ()->AddDownlinkNgbrBearer (bearer);
|
||||
|
||||
bearer = 0;
|
||||
|
||||
|
||||
|
||||
@@ -173,6 +174,8 @@ int main (int argc, char *argv[])
|
||||
|
||||
Simulator::Destroy ();
|
||||
|
||||
delete ipcs;
|
||||
|
||||
std::cout << "Done." << std::endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -231,6 +231,10 @@ int main (int argc, char *argv[])
|
||||
|
||||
Simulator::Destroy ();
|
||||
|
||||
delete ipcs_1;
|
||||
delete ipcs_2;
|
||||
delete ipcs_3;
|
||||
|
||||
std::cout << "Done." << std::endl;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -154,7 +154,7 @@ int main (int argc, char** argv)
|
||||
|
||||
// ****** simulate a packet transmission in the downlink ******
|
||||
|
||||
Ptr<PacketBurst> pb = Create<PacketBurst> ();
|
||||
Ptr<PacketBurst> pb = CreateObject<PacketBurst> ();
|
||||
Ptr<Packet> p1 = Create<Packet> (500);
|
||||
Ptr<Packet> p2 = Create<Packet> (500);
|
||||
pb->AddPacket (p1);
|
||||
|
||||
@@ -151,7 +151,7 @@ int main (int argc, char** argv)
|
||||
|
||||
// ****** simulate a packet transmission in the downlink ******
|
||||
|
||||
Ptr<PacketBurst> pb = Create<PacketBurst> ();
|
||||
Ptr<PacketBurst> pb = CreateObject<PacketBurst> ();
|
||||
Ptr<Packet> p1 = Create<Packet> (500);
|
||||
Ptr<Packet> p2 = Create<Packet> (500);
|
||||
pb->AddPacket (p1);
|
||||
|
||||
@@ -57,6 +57,11 @@ EnbMacEntity::EnbMacEntity ()
|
||||
|
||||
|
||||
EnbMacEntity::~EnbMacEntity ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
EnbMacEntity::DoDispose ()
|
||||
{
|
||||
m_downlinkScheduler = 0;
|
||||
m_uplinkScheduler = 0;
|
||||
@@ -97,7 +102,7 @@ EnbMacEntity::GetDownlinkPacketScheduler (void)
|
||||
|
||||
|
||||
void
|
||||
EnbMacEntity::ReceiveCqiIdealControlMessage (CqiIdealControlMessage* msg)
|
||||
EnbMacEntity::ReceiveCqiIdealControlMessage (Ptr<CqiIdealControlMessage> msg)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << msg);
|
||||
NS_LOG_FUNCTION (this << msg->GetSourceDevice () << msg->GetDestinationDevice ());
|
||||
@@ -124,7 +129,7 @@ EnbMacEntity::ReceiveCqiIdealControlMessage (CqiIdealControlMessage* msg)
|
||||
|
||||
|
||||
void
|
||||
EnbMacEntity::SendPdcchMapIdealControlMessage (PdcchMapIdealControlMessage* msg)
|
||||
EnbMacEntity::SendPdcchMapIdealControlMessage (Ptr<PdcchMapIdealControlMessage> msg)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << msg);
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ public:
|
||||
|
||||
EnbMacEntity (void);
|
||||
virtual ~EnbMacEntity (void);
|
||||
virtual void DoDispose (void);
|
||||
|
||||
/**
|
||||
* \brief Set the uplink packet scheduler
|
||||
@@ -67,13 +68,13 @@ public:
|
||||
* \brief Receive a CQI ideal control message
|
||||
* \param msg the message
|
||||
*/
|
||||
void ReceiveCqiIdealControlMessage (CqiIdealControlMessage* msg);
|
||||
void ReceiveCqiIdealControlMessage (Ptr<CqiIdealControlMessage> msg);
|
||||
|
||||
/**
|
||||
* \brief Send the PDCCH control message
|
||||
* \param msg the message
|
||||
*/
|
||||
void SendPdcchMapIdealControlMessage (PdcchMapIdealControlMessage* msg);
|
||||
void SendPdcchMapIdealControlMessage (Ptr<PdcchMapIdealControlMessage> msg);
|
||||
|
||||
private:
|
||||
Ptr<PacketScheduler> m_uplinkScheduler;
|
||||
|
||||
@@ -53,15 +53,7 @@ TypeId EnbNetDevice::GetTypeId (void)
|
||||
static TypeId
|
||||
tid =
|
||||
TypeId ("ns3::EnbNetDevice")
|
||||
.SetParent<LteNetDevice> ()
|
||||
|
||||
/*
|
||||
.AddAttribute ("UeManager",
|
||||
"The UE manager attached to this device.",
|
||||
PointerValue (),
|
||||
MakePointerAccessor (&EnbNetDevice::GetUeManager,
|
||||
&EnbNetDevice::SetUeManager),
|
||||
MakePointerChecker<UeManager> ())*/;
|
||||
.SetParent<LteNetDevice> ();
|
||||
return tid;
|
||||
}
|
||||
|
||||
@@ -82,11 +74,22 @@ EnbNetDevice::EnbNetDevice (Ptr<Node> node, Ptr<LtePhy> phy)
|
||||
EnbNetDevice::~EnbNetDevice (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
void
|
||||
EnbNetDevice::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_ueManager->Dispose ();
|
||||
m_ueManager = 0;
|
||||
|
||||
m_macEntity->Dispose ();
|
||||
m_macEntity = 0;
|
||||
|
||||
LteNetDevice::DoDispose ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EnbNetDevice::InitEnbNetDevice (void)
|
||||
{
|
||||
@@ -99,17 +102,6 @@ EnbNetDevice::InitEnbNetDevice (void)
|
||||
SetPhy (0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EnbNetDevice::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
LteNetDevice::DoDispose ();
|
||||
m_ueManager = 0;
|
||||
m_macEntity = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EnbNetDevice::Start (void)
|
||||
{
|
||||
|
||||
@@ -58,8 +58,7 @@ public:
|
||||
EnbNetDevice (Ptr<Node> node, Ptr<LtePhy> phy);
|
||||
|
||||
virtual ~EnbNetDevice (void);
|
||||
|
||||
void DoDispose (void);
|
||||
virtual void DoDispose (void);
|
||||
|
||||
/**
|
||||
* \brief Initialize all parameters of this device
|
||||
|
||||
@@ -115,19 +115,19 @@ EnbLtePhy::CalcChannelQualityForUe (std::vector <double> sinr, Ptr<LteSpectrumPh
|
||||
}
|
||||
|
||||
void
|
||||
EnbLtePhy::SendIdealControlMessage (IdealControlMessage* msg)
|
||||
EnbLtePhy::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << msg);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
EnbLtePhy::ReceiveIdealControlMessage (IdealControlMessage* msg)
|
||||
EnbLtePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << msg);
|
||||
if (msg->GetMessageType () == IdealControlMessage::CQI_FEEDBACKS)
|
||||
{
|
||||
CqiIdealControlMessage* msg2 = dynamic_cast<CqiIdealControlMessage*> (msg);
|
||||
Ptr<CqiIdealControlMessage> msg2 = DynamicCast<CqiIdealControlMessage> (msg);
|
||||
Ptr<EnbMacEntity> macEntity = GetDevice ()->GetObject<EnbNetDevice> ()->GetMacEntity ();
|
||||
macEntity->ReceiveCqiIdealControlMessage (msg2);
|
||||
}
|
||||
|
||||
@@ -70,12 +70,12 @@ public:
|
||||
* \brief Send the control message
|
||||
* \param msg the message to send
|
||||
*/
|
||||
virtual void SendIdealControlMessage (IdealControlMessage* msg);
|
||||
virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
|
||||
/**
|
||||
* \brief Receive the control message
|
||||
* \param msg the received message
|
||||
*/
|
||||
virtual void ReceiveIdealControlMessage (IdealControlMessage* msg);
|
||||
virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,8 +30,6 @@ NS_LOG_COMPONENT_DEFINE ("IdealControlMessage");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED ( IdealControlMessage);
|
||||
|
||||
IdealControlMessage::IdealControlMessage (void)
|
||||
: m_source (0),
|
||||
m_destination (0)
|
||||
@@ -41,15 +39,8 @@ IdealControlMessage::IdealControlMessage (void)
|
||||
|
||||
IdealControlMessage::~IdealControlMessage (void)
|
||||
{
|
||||
}
|
||||
|
||||
TypeId
|
||||
IdealControlMessage::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::IdealControlMessage")
|
||||
.SetParent<Object> ()
|
||||
;
|
||||
return tid;
|
||||
m_source = 0;
|
||||
m_destination = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -98,8 +89,6 @@ IdealControlMessage::GetMessageType (void)
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED ( PdcchMapIdealControlMessage);
|
||||
|
||||
PdcchMapIdealControlMessage::PdcchMapIdealControlMessage (void)
|
||||
{
|
||||
m_idealPdcchMessage = new IdealPdcchMessage ();
|
||||
@@ -109,20 +98,9 @@ PdcchMapIdealControlMessage::PdcchMapIdealControlMessage (void)
|
||||
|
||||
PdcchMapIdealControlMessage::~PdcchMapIdealControlMessage (void)
|
||||
{
|
||||
delete m_idealPdcchMessage;
|
||||
delete m_idealPdcchMessage;
|
||||
}
|
||||
|
||||
|
||||
TypeId
|
||||
PdcchMapIdealControlMessage::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::PdcchMapIdealControlMessage")
|
||||
.SetParent<IdealControlMessage> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PdcchMapIdealControlMessage::AddNewRecord (Direction direction,
|
||||
int subChannel, Ptr<LteNetDevice> ue, double mcs)
|
||||
@@ -141,7 +119,6 @@ PdcchMapIdealControlMessage::GetMessage (void)
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED ( CqiIdealControlMessage);
|
||||
|
||||
CqiIdealControlMessage::CqiIdealControlMessage (void)
|
||||
{
|
||||
@@ -155,17 +132,6 @@ CqiIdealControlMessage::~CqiIdealControlMessage (void)
|
||||
delete m_cqiFeedbacks;
|
||||
}
|
||||
|
||||
|
||||
TypeId
|
||||
CqiIdealControlMessage::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::CqiIdealControlMessage")
|
||||
.SetParent<IdealControlMessage> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CqiIdealControlMessage::AddNewRecord (int subChannel, double cqi)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef IDEAL_CONTROL_MESSAGES_H
|
||||
#define IDEAL_CONTROL_MESSAGES_H
|
||||
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/simple-ref-count.h"
|
||||
#include <list>
|
||||
|
||||
@@ -38,8 +38,7 @@ class LteNetDevice;
|
||||
class IdealControlMessage : public SimpleRefCount<IdealControlMessage>
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
|
||||
/**
|
||||
* The type of the message
|
||||
*/
|
||||
@@ -125,7 +124,6 @@ class LteNetDevice;
|
||||
class PdcchMapIdealControlMessage : public IdealControlMessage
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
PdcchMapIdealControlMessage (void);
|
||||
virtual ~PdcchMapIdealControlMessage (void);
|
||||
@@ -205,7 +203,6 @@ class LteNetDevice;
|
||||
class CqiIdealControlMessage : public IdealControlMessage
|
||||
{
|
||||
public:
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
CqiIdealControlMessage (void);
|
||||
virtual ~CqiIdealControlMessage (void);
|
||||
|
||||
@@ -101,8 +101,8 @@ public:
|
||||
*/
|
||||
uint32_t GetNBytes (void) const;
|
||||
/**
|
||||
* \brief Get the length of the queue with MAC + RLC + CRC overheads
|
||||
* \return the length of the queue with MAC + RLC + CRC overheads
|
||||
* \brief Get the length of the queue with MAC + RLC + CRC overhead
|
||||
* \return the length of the queue with MAC + RLC + CRC overhead
|
||||
*/
|
||||
uint32_t GetQueueLengthWithMACOverhead (void);
|
||||
|
||||
|
||||
@@ -69,14 +69,12 @@ TypeId LteNetDevice::GetTypeId (void)
|
||||
LteNetDevice::LteNetDevice (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_rrcEntity = CreateObject<RrcEntity> ();
|
||||
}
|
||||
|
||||
|
||||
LteNetDevice::~LteNetDevice (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_rrcEntity = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,9 +83,10 @@ LteNetDevice::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
m_phy->DoDispose ();
|
||||
m_phy->Dispose ();
|
||||
m_phy = 0;
|
||||
m_node = 0;
|
||||
m_rrcEntity->Dispose ();
|
||||
m_rrcEntity = 0;
|
||||
m_phyMacTxStartCallback = MakeNullCallback< bool, Ptr<Packet> > ();
|
||||
NetDevice::DoDispose ();
|
||||
|
||||
@@ -51,7 +51,6 @@ LtePhy::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::LtePhy")
|
||||
.SetParent<Object> ()
|
||||
// .AddConstructor<LtePhy> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -61,6 +60,15 @@ LtePhy::~LtePhy ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
LtePhy::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downlinkSpectrumPhy = 0;
|
||||
m_uplinkSpectrumPhy = 0;
|
||||
m_netDevice = 0;
|
||||
}
|
||||
|
||||
void
|
||||
LtePhy::SetDevice (Ptr<LteNetDevice> d)
|
||||
{
|
||||
@@ -204,16 +212,6 @@ LtePhy::GetTxPower (void)
|
||||
return m_txPower;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LtePhy::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downlinkSpectrumPhy = 0;
|
||||
m_uplinkSpectrumPhy = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LtePhy::SetTti (double tti)
|
||||
{
|
||||
|
||||
@@ -178,12 +178,12 @@ public:
|
||||
* \brief Send SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
|
||||
* \param msg the Ideal Control Message to send
|
||||
*/
|
||||
virtual void SendIdealControlMessage (IdealControlMessage* msg) = 0;
|
||||
virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
|
||||
/**
|
||||
* \brief Receive SendIdealControlMessage (PDCCH map, CQI feedbacks) using the ideal control channel
|
||||
* \param msg the Ideal Control Message to receive
|
||||
*/
|
||||
virtual void ReceiveIdealControlMessage (IdealControlMessage* msg) = 0;
|
||||
virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg) = 0;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,13 +56,12 @@ namespace ns3 {
|
||||
NS_OBJECT_ENSURE_REGISTERED (JakesFadingLossModel);
|
||||
|
||||
JakesFadingLossModel::JakesFadingLossModel ()
|
||||
: m_nbOfPaths (1, 4),
|
||||
m_startJakes (1, 2000),
|
||||
m_phy (0)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
SetSamplingPeriod (0.5); // default value
|
||||
m_multipath = new MultipathForFrequencyDomain ();
|
||||
m_nbOfPaths = new UniformVariable (1, 4);
|
||||
m_startJakes = new UniformVariable (1, 2000);
|
||||
m_phy = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,9 +78,7 @@ JakesFadingLossModel::GetTypeId (void)
|
||||
|
||||
JakesFadingLossModel::~JakesFadingLossModel ()
|
||||
{
|
||||
delete m_multipath;
|
||||
delete m_nbOfPaths;
|
||||
delete m_startJakes;
|
||||
m_phy = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +105,7 @@ JakesFadingLossModel::SetValue (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
m_multipath->clear ();
|
||||
m_multipath.clear ();
|
||||
|
||||
int downlinkSubChannels = GetPhy ()->GetDownlinkSubChannels ().size ();
|
||||
|
||||
@@ -156,12 +153,12 @@ JakesFadingLossModel::SetValue (void)
|
||||
|
||||
// number of path = M
|
||||
// x = 1 -> M=6, x = 2 -> M=8, x = 3 -> M=10, x = 4 -> M=12
|
||||
int x = m_nbOfPaths->GetValue ();
|
||||
int x = m_nbOfPaths.GetValue ();
|
||||
|
||||
for (int i = 0; i < downlinkSubChannels; i++)
|
||||
{
|
||||
// StartJakes allow us to select a window of 0.5ms into the Jakes realization lasting 3s.
|
||||
int startJakes = m_startJakes->GetValue ();
|
||||
int startJakes = m_startJakes.GetValue ();
|
||||
|
||||
MultipathForTimeDomain multipathForTimeDomain;
|
||||
|
||||
@@ -302,7 +299,7 @@ JakesFadingLossModel::SetValue (void)
|
||||
}
|
||||
|
||||
|
||||
m_multipath->push_back (multipathForTimeDomain);
|
||||
m_multipath.push_back (multipathForTimeDomain);
|
||||
}
|
||||
|
||||
SetLastUpdate ();
|
||||
@@ -323,9 +320,9 @@ JakesFadingLossModel::GetValue (int subChannel)
|
||||
int index = now_ms - lastUpdate_ms;
|
||||
|
||||
NS_LOG_FUNCTION (this << subChannel << now_ms
|
||||
<< lastUpdate_ms << index << m_multipath->at (subChannel).at (index));
|
||||
<< lastUpdate_ms << index << m_multipath.at (subChannel).at (index));
|
||||
|
||||
return m_multipath->at (subChannel).at (index);
|
||||
return m_multipath.at (subChannel).at (index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -87,10 +87,11 @@ public:
|
||||
typedef std::vector<MultipathForTimeDomain> MultipathForFrequencyDomain;
|
||||
|
||||
private:
|
||||
MultipathForFrequencyDomain *m_multipath;
|
||||
|
||||
UniformVariable *m_nbOfPaths;
|
||||
UniformVariable *m_startJakes;
|
||||
MultipathForFrequencyDomain m_multipath;
|
||||
|
||||
UniformVariable m_nbOfPaths;
|
||||
UniformVariable m_startJakes;
|
||||
|
||||
Ptr<LtePhy> m_phy;
|
||||
};
|
||||
|
||||
@@ -49,17 +49,15 @@ PacketScheduler::PacketScheduler (Ptr<EnbNetDevice> enb)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
TypeId
|
||||
PacketScheduler::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::PacketScheduler")
|
||||
.SetParent<Object> ()
|
||||
.AddConstructor<PacketScheduler> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
PacketScheduler::~PacketScheduler ()
|
||||
@@ -67,6 +65,14 @@ PacketScheduler::~PacketScheduler ()
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
void
|
||||
PacketScheduler::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_enb = 0;
|
||||
m_macEntity = 0;
|
||||
Object::DoDispose ();
|
||||
}
|
||||
|
||||
void
|
||||
PacketScheduler::SetDevice (Ptr<EnbNetDevice> enb)
|
||||
|
||||
@@ -49,8 +49,9 @@ public:
|
||||
*/
|
||||
PacketScheduler (Ptr<EnbNetDevice> enb);
|
||||
virtual ~PacketScheduler ();
|
||||
virtual void DoDispose (void);
|
||||
|
||||
// static TypeId GetTypeId (void);
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
/**
|
||||
* \brief Set the device where the scheduler works
|
||||
|
||||
@@ -52,17 +52,31 @@ RadioBearerInstance::RadioBearerInstance ()
|
||||
m_rlcEntity (CreateObject<RlcEntity> ()),
|
||||
m_ipcsClassifierRecord (0)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_rlcEntity->SetRadioBearer (this);
|
||||
}
|
||||
|
||||
|
||||
RadioBearerInstance::~RadioBearerInstance ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_rlcEntity = 0;
|
||||
m_queue = 0;
|
||||
m_ipcsClassifierRecord = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RadioBearerInstance::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_queue = 0;
|
||||
m_qosParameters = 0;
|
||||
m_rlcEntity->Dispose ();
|
||||
m_rlcEntity = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RadioBearerInstance::SetBearerDirection (BearerDirection direction)
|
||||
{
|
||||
@@ -105,13 +119,6 @@ RadioBearerInstance::GetQosParameters (void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RadioBearerInstance::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_queue = 0;
|
||||
}
|
||||
|
||||
|
||||
Ptr<LteMacQueue>
|
||||
RadioBearerInstance::GetQueue (void) const
|
||||
@@ -178,6 +185,7 @@ void
|
||||
RadioBearerInstance::SetIpcsClassifierRecord (IpcsClassifierRecord* c)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << c);
|
||||
NS_ASSERT (m_ipcsClassifierRecord == 0);
|
||||
m_ipcsClassifierRecord = c;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,13 @@ RlcEntity::~RlcEntity ()
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
void
|
||||
RlcEntity::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_device = 0;
|
||||
m_bearer = 0;
|
||||
}
|
||||
|
||||
void
|
||||
RlcEntity::SetDevice (Ptr<LteNetDevice> d)
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
*/
|
||||
RlcEntity (Ptr<LteNetDevice> d);
|
||||
virtual ~RlcEntity (void);
|
||||
virtual void DoDispose (void);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,33 +52,55 @@ TypeId RrcEntity::GetTypeId (void)
|
||||
|
||||
RrcEntity::RrcEntity ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
CreateBearersContainer ();
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downlinkGbrBearersContainer = new BearersContainer ();
|
||||
m_downlinkNgbrBearersContainer = new BearersContainer ();
|
||||
m_uplinkGbrBearersContainer = new BearersContainer ();
|
||||
m_uplinkNgbrBearersContainer = new BearersContainer ();
|
||||
|
||||
m_defaultBearer = CreateObject<RadioBearerInstance> ();
|
||||
}
|
||||
|
||||
|
||||
RrcEntity::~RrcEntity ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
delete m_downlinkGbrBearersContainer;
|
||||
delete m_downlinkNgbrBearersContainer;
|
||||
delete m_uplinkGbrBearersContainer;
|
||||
delete m_uplinkNgbrBearersContainer;
|
||||
m_defaultBearer = 0;
|
||||
}
|
||||
|
||||
void
|
||||
RrcEntity::CreateBearersContainer ()
|
||||
RrcEntity::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downlinkGbrBearersContainer = new BearersContainer ();
|
||||
m_downlinkNgbrBearersContainer = new BearersContainer ();
|
||||
m_uplinkGbrBearersContainer = new BearersContainer ();
|
||||
m_uplinkNgbrBearersContainer = new BearersContainer ();
|
||||
|
||||
m_defaultBearer = CreateObject<RadioBearerInstance> ();
|
||||
// RadioBearerInstance has a ref to RlcEntity
|
||||
// which has a ref to RrcEntity
|
||||
// which has a ref to RadioBearerInstance
|
||||
// so we have to break this ref cycle by manually Disposing all RadioBearerInstances
|
||||
|
||||
DisposeAllElements (m_downlinkGbrBearersContainer);
|
||||
DisposeAllElements (m_downlinkNgbrBearersContainer);
|
||||
DisposeAllElements (m_uplinkGbrBearersContainer);
|
||||
DisposeAllElements (m_uplinkNgbrBearersContainer);
|
||||
|
||||
delete m_downlinkGbrBearersContainer;
|
||||
delete m_downlinkNgbrBearersContainer;
|
||||
delete m_uplinkGbrBearersContainer;
|
||||
delete m_uplinkNgbrBearersContainer;
|
||||
|
||||
m_defaultBearer->Dispose ();
|
||||
m_defaultBearer = 0;
|
||||
Object::DoDispose ();
|
||||
}
|
||||
|
||||
void
|
||||
RrcEntity::DisposeAllElements (BearersContainer *c)
|
||||
{
|
||||
for (BearersContainer::iterator it = c->begin (); it != c->end (); ++it)
|
||||
{
|
||||
(*it)->Dispose ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RrcEntity::BearersContainer*
|
||||
RrcEntity::GetDownlinkGbrBearers (void) const
|
||||
|
||||
@@ -42,17 +42,13 @@ public:
|
||||
|
||||
RrcEntity (void);
|
||||
virtual ~RrcEntity (void);
|
||||
virtual void DoDispose (void);
|
||||
|
||||
/**
|
||||
* \brief A cointainer of bearer with the same QoS requirements
|
||||
*/
|
||||
typedef std::vector< Ptr<RadioBearerInstance> > BearersContainer;
|
||||
|
||||
/**
|
||||
* \brief Creates all bearer containers for this node
|
||||
*/
|
||||
void CreateBearersContainer (void);
|
||||
|
||||
/**
|
||||
* \brief Get all GBR downlink bearers of this node
|
||||
* \return a pointer to the BearersContainer of downlink GBR bearers
|
||||
@@ -117,6 +113,9 @@ public:
|
||||
Ptr<RadioBearerInstance> GetDefaultBearer (void);
|
||||
|
||||
private:
|
||||
|
||||
void DisposeAllElements (BearersContainer *c);
|
||||
|
||||
BearersContainer* m_downlinkGbrBearersContainer;
|
||||
BearersContainer* m_downlinkNgbrBearersContainer;
|
||||
|
||||
|
||||
@@ -30,18 +30,18 @@ namespace ns3 {
|
||||
NS_OBJECT_ENSURE_REGISTERED (ShadowingLossModel);
|
||||
|
||||
ShadowingLossModel::ShadowingLossModel ()
|
||||
: m_randVariable (.0, 8.)
|
||||
{
|
||||
m_randVariable = new LogNormalVariable (.0, 8.);
|
||||
SetValue (m_randVariable->GetValue ());
|
||||
SetValue (m_randVariable.GetValue ());
|
||||
SetLastUpdate ();
|
||||
SetSamplingPeriod (0.5); // defauld value
|
||||
}
|
||||
|
||||
|
||||
ShadowingLossModel::ShadowingLossModel (double mu, double sigma, double samplingPeriod)
|
||||
: m_randVariable (mu, sigma)
|
||||
{
|
||||
m_randVariable = new LogNormalVariable (mu, sigma);
|
||||
SetValue (m_randVariable->GetValue ());
|
||||
SetValue (m_randVariable.GetValue ());
|
||||
SetLastUpdate ();
|
||||
SetSamplingPeriod (samplingPeriod); // defauld value
|
||||
}
|
||||
@@ -60,7 +60,6 @@ ShadowingLossModel::GetTypeId (void)
|
||||
|
||||
ShadowingLossModel::~ShadowingLossModel ()
|
||||
{
|
||||
delete m_randVariable;
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +77,7 @@ ShadowingLossModel::GetValue (void)
|
||||
NS_LOG_FUNCTION (this);
|
||||
if (NeedForUpdate ())
|
||||
{
|
||||
double sh = m_randVariable->GetValue ();
|
||||
double sh = m_randVariable.GetValue ();
|
||||
SetValue (sh);
|
||||
SetLastUpdate ();
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
double GetValue (void);
|
||||
|
||||
private:
|
||||
LogNormalVariable* m_randVariable;
|
||||
LogNormalVariable m_randVariable;
|
||||
double m_shadowingValue;
|
||||
};
|
||||
|
||||
|
||||
@@ -44,14 +44,13 @@ NS_OBJECT_ENSURE_REGISTERED (SimplePacketScheduler);
|
||||
SimplePacketScheduler::SimplePacketScheduler ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
SetDevice (0);
|
||||
}
|
||||
|
||||
|
||||
SimplePacketScheduler::SimplePacketScheduler (Ptr<EnbNetDevice> enb)
|
||||
: PacketScheduler (enb)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << enb);
|
||||
SetDevice (enb);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +79,7 @@ SimplePacketScheduler::DoRunPacketScheduler (void)
|
||||
|
||||
|
||||
Ptr<PacketBurst> pb = CreateObject<PacketBurst> ();
|
||||
PdcchMapIdealControlMessage* msg = new PdcchMapIdealControlMessage ();
|
||||
Ptr<PdcchMapIdealControlMessage> msg = Create<PdcchMapIdealControlMessage> ();
|
||||
|
||||
|
||||
//This scheduler takes one packet from each bearer
|
||||
@@ -141,8 +140,6 @@ SimplePacketScheduler::DoRunPacketScheduler (void)
|
||||
|
||||
GetMacEntity ()->GetObject<EnbMacEntity> ()->SendPdcchMapIdealControlMessage (msg);
|
||||
|
||||
delete msg;
|
||||
|
||||
enb->StartTransmission ();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ UeMacEntity::~UeMacEntity ()
|
||||
{
|
||||
}
|
||||
|
||||
CqiIdealControlMessage*
|
||||
Ptr<CqiIdealControlMessage>
|
||||
UeMacEntity::CreateCqiFeedbacks (std::vector<double> sinr)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
@@ -70,7 +70,7 @@ UeMacEntity::CreateCqiFeedbacks (std::vector<double> sinr)
|
||||
|
||||
|
||||
// CREATE CqiIdealControlMessage
|
||||
CqiIdealControlMessage* msg = new CqiIdealControlMessage ();
|
||||
Ptr<CqiIdealControlMessage> msg = Create<CqiIdealControlMessage> ();
|
||||
|
||||
msg->SetSourceDevice (thisDevice);
|
||||
msg->SetDestinationDevice (remoteDevice);
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
* computed at the physical layer when is received a signal from the eNB
|
||||
* \param sinr list of SINR values
|
||||
*/
|
||||
CqiIdealControlMessage* CreateCqiFeedbacks (std::vector<double> sinr);
|
||||
Ptr<CqiIdealControlMessage> CreateCqiFeedbacks (std::vector<double> sinr);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ UeManager::UeManager (void)
|
||||
|
||||
UeManager::~UeManager (void)
|
||||
{
|
||||
delete m_ueRecords;
|
||||
delete m_ueRecords;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -88,6 +88,14 @@ UeNetDevice::UeNetDevice (Ptr<Node> node, Ptr<LtePhy> phy, Ptr<EnbNetDevice> tar
|
||||
UeNetDevice::~UeNetDevice (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
void
|
||||
UeNetDevice::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_targetEnb = 0;
|
||||
m_macEntity->Dispose ();
|
||||
m_macEntity = 0;
|
||||
LteNetDevice::DoDispose ();
|
||||
}
|
||||
@@ -120,14 +128,6 @@ UeNetDevice::GetMacEntity (void)
|
||||
return m_macEntity;
|
||||
}
|
||||
|
||||
void
|
||||
UeNetDevice::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
LteNetDevice::DoDispose ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
UeNetDevice::Start (void)
|
||||
{
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
*/
|
||||
UeNetDevice (Ptr<Node> node, Ptr<LtePhy> phy, Ptr<EnbNetDevice> targetEnb);
|
||||
virtual ~UeNetDevice (void);
|
||||
virtual void DoDispose ();
|
||||
|
||||
/**
|
||||
* \brief Set the MAC entity
|
||||
@@ -77,8 +78,6 @@ public:
|
||||
Ptr<UeMacEntity> GetMacEntity (void);
|
||||
|
||||
|
||||
void DoDispose (void);
|
||||
|
||||
/**
|
||||
* \brief Initialize the UE
|
||||
*/
|
||||
|
||||
@@ -153,13 +153,12 @@ UeLtePhy::CreateCqiFeedbacks (std::vector<double> sinr)
|
||||
NS_LOG_FUNCTION (this);
|
||||
Ptr<UeNetDevice> thisDevice = GetDevice ()->GetObject<UeNetDevice> ();
|
||||
Ptr<UeMacEntity> mac = thisDevice->GetMacEntity ()->GetObject<UeMacEntity> ();
|
||||
CqiIdealControlMessage* msg = mac->CreateCqiFeedbacks (sinr);
|
||||
Ptr<CqiIdealControlMessage> msg = mac->CreateCqiFeedbacks (sinr);
|
||||
SendIdealControlMessage (msg);
|
||||
delete msg;
|
||||
}
|
||||
|
||||
void
|
||||
UeLtePhy::SendIdealControlMessage (IdealControlMessage* msg)
|
||||
UeLtePhy::SendIdealControlMessage (Ptr<IdealControlMessage> msg)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << msg);
|
||||
Ptr<LtePhy> phy = msg->GetDestinationDevice ()->GetPhy ();
|
||||
@@ -168,13 +167,13 @@ UeLtePhy::SendIdealControlMessage (IdealControlMessage* msg)
|
||||
|
||||
|
||||
void
|
||||
UeLtePhy::ReceiveIdealControlMessage (IdealControlMessage* msg)
|
||||
UeLtePhy::ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << msg);
|
||||
|
||||
if (msg->GetMessageType () == IdealControlMessage::ALLOCATION_MAP)
|
||||
{
|
||||
PdcchMapIdealControlMessage* msg2 = dynamic_cast<PdcchMapIdealControlMessage*> (msg);
|
||||
Ptr<PdcchMapIdealControlMessage> msg2 = DynamicCast<PdcchMapIdealControlMessage> (msg);
|
||||
|
||||
std::vector <int> ulSubChennels;
|
||||
std::vector <int> dlSubChennels;
|
||||
|
||||
@@ -95,8 +95,8 @@ public:
|
||||
*/
|
||||
void CreateCqiFeedbacks (std::vector<double> sinr);
|
||||
|
||||
virtual void SendIdealControlMessage (IdealControlMessage* msg);
|
||||
virtual void ReceiveIdealControlMessage (IdealControlMessage* msg);
|
||||
virtual void SendIdealControlMessage (Ptr<IdealControlMessage> msg);
|
||||
virtual void ReceiveIdealControlMessage (Ptr<IdealControlMessage> msg);
|
||||
|
||||
private:
|
||||
std::vector <int> m_subChannelsForTransmission;
|
||||
|
||||
@@ -31,10 +31,6 @@ UeRecord::UeRecord (void)
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
UeRecord::~UeRecord (void)
|
||||
{
|
||||
}
|
||||
|
||||
UeRecord::UeRecord (Ptr<NetDevice> ue, Ptr<NetDevice> enb)
|
||||
: m_ue (ue),
|
||||
m_enb (enb)
|
||||
@@ -42,6 +38,12 @@ UeRecord::UeRecord (Ptr<NetDevice> ue, Ptr<NetDevice> enb)
|
||||
NS_LOG_FUNCTION (this << ue << enb);
|
||||
}
|
||||
|
||||
UeRecord::~UeRecord (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_ue = 0;
|
||||
m_enb = 0;
|
||||
}
|
||||
|
||||
void
|
||||
UeRecord::SetUe (Ptr<NetDevice> ue)
|
||||
|
||||
Reference in New Issue
Block a user