diff --git a/src/lte/helper/lena-helper.cc b/src/lte/helper/lena-helper.cc index a6187cca2..eab6bbda1 100644 --- a/src/lte/helper/lena-helper.cc +++ b/src/lte/helper/lena-helper.cc @@ -135,13 +135,10 @@ LenaHelper::SetUeDeviceAttribute (std::string name, const AttributeValue &value) Ptr LenaHelper::InstallSingleEnbDevice (Ptr n) { - Ptr phy = CreateObject (); - Ptr dlPhy = CreateObject (); Ptr ulPhy = CreateObject (); - - phy->SetDownlinkSpectrumPhy (dlPhy); - phy->SetUplinkSpectrumPhy (ulPhy); + + Ptr phy = CreateObject (dlPhy, ulPhy); Ptr noisePsd = LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity (); ulPhy->SetNoisePowerSpectralDensity (noisePsd); @@ -193,13 +190,10 @@ LenaHelper::InstallSingleEnbDevice (Ptr n) Ptr LenaHelper::InstallSingleUeDevice (Ptr n) { - Ptr phy = CreateObject (); - Ptr dlPhy = CreateObject (); Ptr ulPhy = CreateObject (); - phy->SetDownlinkSpectrumPhy (dlPhy); - phy->SetUplinkSpectrumPhy (ulPhy); + Ptr phy = CreateObject (dlPhy, ulPhy); Ptr noisePsd = LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity (); dlPhy->SetNoisePowerSpectralDensity (noisePsd); diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index e84cadeb6..7b6f44972 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -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 dlPhy, Ptr ulPhy) + : LtePhy (dlPhy, ulPhy), + m_nrFrames (0), m_nrSubFrames (0) { m_enbPhySapProvider = new EnbMemberLteEnbPhySapProvider (this); Simulator::ScheduleNow (&LteEnbPhy::StartFrame, this); } - TypeId LteEnbPhy::GetTypeId (void) { diff --git a/src/lte/model/lte-enb-phy.h b/src/lte/model/lte-enb-phy.h index 4d2c1b7b8..ab127962a 100644 --- a/src/lte/model/lte-enb-phy.h +++ b/src/lte/model/lte-enb-phy.h @@ -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 d); + LteEnbPhy (); + + /** + * + * \param dlPhy the downlink LteSpectrumPhy instance + * \param ulPhy the uplink LteSpectrumPhy instance + */ + LteEnbPhy (Ptr dlPhy, Ptr ulPhy); + virtual ~LteEnbPhy (); static TypeId GetTypeId (void); diff --git a/src/lte/model/lte-phy.cc b/src/lte/model/lte-phy.cc index da15d78c2..d8311b2c2 100644 --- a/src/lte/model/lte-phy.cc +++ b/src/lte/model/lte-phy.cc @@ -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 dlPhy, Ptr 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 s) -{ - NS_LOG_FUNCTION (this << s); - m_downlinkSpectrumPhy = s; -} - - -void -LtePhy::SetUplinkSpectrumPhy (Ptr s) -{ - NS_LOG_FUNCTION (this << s); - m_uplinkSpectrumPhy = s; -} - void LtePhy::SetDownlinkChannel (Ptr c) { diff --git a/src/lte/model/lte-phy.h b/src/lte/model/lte-phy.h index 1d0c5bdad..ffcee85c7 100644 --- a/src/lte/model/lte-phy.h +++ b/src/lte/model/lte-phy.h @@ -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 dlPhy, Ptr ulPhy); + virtual ~LtePhy (); static TypeId GetTypeId (void); @@ -70,18 +81,6 @@ public: */ virtual void DoSendMacPdu (Ptr p) = 0; - /** - * Set the LTE SpectrumPhy for the downlink - * \param s the LTE SpectrumPhy - */ - void SetDownlinkSpectrumPhy (Ptr s); - - /** - * Set the LTE SpectrumPhy for the uplink - * \param s the LTE SpectrumPhy - */ - void SetUplinkSpectrumPhy (Ptr s); - /** * Set the downlink channel * \param c the downlink channel diff --git a/src/lte/model/lte-ue-phy.cc b/src/lte/model/lte-ue-phy.cc index 01543b5aa..a9c73b24c 100644 --- a/src/lte/model/lte-ue-phy.cc +++ b/src/lte/model/lte-ue-phy.cc @@ -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 dlPhy, Ptr ulPhy) + : LtePhy (dlPhy, ulPhy), + m_p10CqiPeriocity (MilliSeconds (160)), m_p10CqiLast (MilliSeconds (0)), m_a30CqiPeriocity (MilliSeconds (1)), // ideal behavior m_a30CqiLast (MilliSeconds (0)) diff --git a/src/lte/model/lte-ue-phy.h b/src/lte/model/lte-ue-phy.h index 65f9510df..73e825d9e 100644 --- a/src/lte/model/lte-ue-phy.h +++ b/src/lte/model/lte-ue-phy.h @@ -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 dlPhy, Ptr ulPhy); + virtual ~LteUePhy (); + virtual void DoDispose (); static TypeId GetTypeId (void); diff --git a/src/lte/test/lena-test-downlink-sinr.cc b/src/lte/test/lena-test-downlink-sinr.cc index 696b4c1f0..b4f42b74b 100644 --- a/src/lte/test/lena-test-downlink-sinr.cc +++ b/src/lte/test/lena-test-downlink-sinr.cc @@ -85,11 +85,11 @@ LenaDownlinkSinrTestCase::DoRun (void) /** * Instantiate a single receiving LteSpectrumPhy */ - Ptr uePhy = CreateObject (); Ptr dlPhy = CreateObject (); + Ptr ulPhy = CreateObject (); + Ptr uePhy = CreateObject (dlPhy, ulPhy); dlPhy->SetCellId (100); - uePhy->SetDownlinkSpectrumPhy (dlPhy); Ptr p = Create (uePhy->GetObject ()); dlPhy->AddSinrChunkProcessor (p);