LteSpectrumPhy instances now plugged onto LtePhy via its constructor

This commit is contained in:
Nicola Baldo
2011-04-26 12:35:46 +02:00
parent 4782ae5606
commit 770ef168bc
8 changed files with 64 additions and 50 deletions

View File

@@ -135,13 +135,10 @@ LenaHelper::SetUeDeviceAttribute (std::string name, const AttributeValue &value)
Ptr<NetDevice>
LenaHelper::InstallSingleEnbDevice (Ptr<Node> n)
{
Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> ();
Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
phy->SetDownlinkSpectrumPhy (dlPhy);
phy->SetUplinkSpectrumPhy (ulPhy);
Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> (dlPhy, ulPhy);
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity ();
ulPhy->SetNoisePowerSpectralDensity (noisePsd);
@@ -193,13 +190,10 @@ LenaHelper::InstallSingleEnbDevice (Ptr<Node> n)
Ptr<NetDevice>
LenaHelper::InstallSingleUeDevice (Ptr<Node> n)
{
Ptr<LteUePhy> phy = CreateObject<LteUePhy> ();
Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
phy->SetDownlinkSpectrumPhy (dlPhy);
phy->SetUplinkSpectrumPhy (ulPhy);
Ptr<LteUePhy> phy = CreateObject<LteUePhy> (dlPhy, ulPhy);
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity ();
dlPhy->SetNoisePowerSpectralDensity (noisePsd);

View File

@@ -102,14 +102,20 @@ NS_OBJECT_ENSURE_REGISTERED (LteEnbPhy);
LteEnbPhy::LteEnbPhy ()
: m_nrFrames (0),
{
NS_LOG_FUNCTION (this);
NS_FATAL_ERROR ("This constructor should not be called");
}
LteEnbPhy::LteEnbPhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
: LtePhy (dlPhy, ulPhy),
m_nrFrames (0),
m_nrSubFrames (0)
{
m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this);
Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this);
}
TypeId
LteEnbPhy::GetTypeId (void)
{

View File

@@ -42,13 +42,19 @@ class LteEnbPhy : public LtePhy
friend class EnbMemberLteEnbPhySapProvider;
public:
LteEnbPhy ();
/**
* \brief Create the eNB phy layer
* \param d the device where the phy layer is attached
/**
* @warning the default constructor should not be used
*/
LteEnbPhy (Ptr<LteNetDevice> d);
LteEnbPhy ();
/**
*
* \param dlPhy the downlink LteSpectrumPhy instance
* \param ulPhy the uplink LteSpectrumPhy instance
*/
LteEnbPhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy);
virtual ~LteEnbPhy ();
static TypeId GetTypeId (void);

View File

@@ -35,12 +35,16 @@ namespace ns3 {
NS_OBJECT_ENSURE_REGISTERED (LtePhy);
LtePhy::LtePhy ()
{
NS_LOG_FUNCTION (this);
NS_FATAL_ERROR ("This constructor should not be called");
}
LtePhy::LtePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
: m_netDevice (0),
m_downlinkSpectrumPhy (0),
m_uplinkSpectrumPhy (0),
m_downlinkSpectrumPhy (dlPhy),
m_uplinkSpectrumPhy (ulPhy),
m_txPower (43), // dBm
m_tti (0.001),
m_ulBandwidth (0),
@@ -107,21 +111,6 @@ LtePhy::GetDevice ()
}
void
LtePhy::SetDownlinkSpectrumPhy (Ptr<LteSpectrumPhy> s)
{
NS_LOG_FUNCTION (this << s);
m_downlinkSpectrumPhy = s;
}
void
LtePhy::SetUplinkSpectrumPhy (Ptr<LteSpectrumPhy> s)
{
NS_LOG_FUNCTION (this << s);
m_uplinkSpectrumPhy = s;
}
void
LtePhy::SetDownlinkChannel (Ptr<SpectrumChannel> c)
{

View File

@@ -48,7 +48,18 @@ class LtePhy : public Object
{
public:
/**
* @warning the default constructor should not be used
*/
LtePhy ();
/**
*
* \param dlPhy the downlink LteSpectrumPhy instance
* \param ulPhy the uplink LteSpectrumPhy instance
*/
LtePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy);
virtual ~LtePhy ();
static TypeId GetTypeId (void);
@@ -70,18 +81,6 @@ public:
*/
virtual void DoSendMacPdu (Ptr<Packet> p) = 0;
/**
* Set the LTE SpectrumPhy for the downlink
* \param s the LTE SpectrumPhy
*/
void SetDownlinkSpectrumPhy (Ptr<LteSpectrumPhy> s);
/**
* Set the LTE SpectrumPhy for the uplink
* \param s the LTE SpectrumPhy
*/
void SetUplinkSpectrumPhy (Ptr<LteSpectrumPhy> s);
/**
* Set the downlink channel
* \param c the downlink channel

View File

@@ -95,7 +95,14 @@ NS_OBJECT_ENSURE_REGISTERED (LteUePhy);
LteUePhy::LteUePhy ()
: m_p10CqiPeriocity (MilliSeconds (160)),
{
NS_LOG_FUNCTION (this);
NS_FATAL_ERROR ("This constructor should not be called");
}
LteUePhy::LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
: LtePhy (dlPhy, ulPhy),
m_p10CqiPeriocity (MilliSeconds (160)),
m_p10CqiLast (MilliSeconds (0)),
m_a30CqiPeriocity (MilliSeconds (1)), // ideal behavior
m_a30CqiLast (MilliSeconds (0))

View File

@@ -48,8 +48,21 @@ class LteUePhy : public LtePhy
public:
/**
* @warning the default constructor should not be used
*/
LteUePhy ();
/**
*
* \param dlPhy the downlink LteSpectrumPhy instance
* \param ulPhy the uplink LteSpectrumPhy instance
*/
LteUePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy);
virtual ~LteUePhy ();
virtual void DoDispose ();
static TypeId GetTypeId (void);

View File

@@ -85,11 +85,11 @@ LenaDownlinkSinrTestCase::DoRun (void)
/**
* Instantiate a single receiving LteSpectrumPhy
*/
Ptr<LteUePhy> uePhy = CreateObject<LteUePhy> ();
Ptr<LteSpectrumPhy> dlPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteSpectrumPhy> ulPhy = CreateObject<LteSpectrumPhy> ();
Ptr<LteUePhy> uePhy = CreateObject<LteUePhy> (dlPhy, ulPhy);
dlPhy->SetCellId (100);
uePhy->SetDownlinkSpectrumPhy (dlPhy);
Ptr<LenaTestSinrChunkProcessor> p = Create<LenaTestSinrChunkProcessor> (uePhy->GetObject<LtePhy> ());
dlPhy->AddSinrChunkProcessor (p);