From 0ce02e123be4cd776241b0daf95d8e1322935aa6 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Wed, 6 Apr 2011 14:48:55 +0200 Subject: [PATCH] added TX power attribute --- src/lte/model/lte-enb-phy.cc | 23 ++++++++++++++++++++++- src/lte/model/lte-enb-phy.h | 9 +++++++++ src/lte/model/lte-phy.cc | 16 ---------------- src/lte/model/lte-phy.h | 11 ----------- src/lte/model/lte-ue-phy.cc | 21 ++++++++++++++++++++- src/lte/model/lte-ue-phy.h | 11 +++++++++++ 6 files changed, 62 insertions(+), 29 deletions(-) diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index 6ce1b2fef..801732a39 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -23,7 +23,10 @@ #include #include #include -#include "ns3/spectrum-error-model.h" +#include +#include + + #include "lte-enb-phy.h" #include "lte-net-device.h" #include "lte-spectrum-value-helper.h" @@ -112,6 +115,12 @@ LteEnbPhy::GetTypeId (void) static TypeId tid = TypeId ("ns3::LteEnbPhy") .SetParent () .AddConstructor () + .AddAttribute ("TxPower", + "Transmission power in dBm", + DoubleValue (30.0), + MakeDoubleAccessor (&LteEnbPhy::SetTxPower, + &LteEnbPhy::GetTxPower), + MakeDoubleChecker ()) ; return tid; } @@ -142,7 +151,19 @@ LteEnbPhy::GetLteEnbPhySapProvider () return (m_enbPhySapProvider); } +void +LteEnbPhy::SetTxPower (double pow) +{ + NS_LOG_FUNCTION (this << pow); + m_txPower = pow; +} +double +LteEnbPhy::GetTxPower () const +{ + NS_LOG_FUNCTION (this); + return m_txPower; +} bool LteEnbPhy::AddUePhy (uint8_t rnti, Ptr phy) diff --git a/src/lte/model/lte-enb-phy.h b/src/lte/model/lte-enb-phy.h index 54c4b6875..4d2c1b7b8 100644 --- a/src/lte/model/lte-enb-phy.h +++ b/src/lte/model/lte-enb-phy.h @@ -67,6 +67,15 @@ public: */ void SetLteEnbPhySapUser (LteEnbPhySapUser* s); + /** + * \param pw the transmission power in dBm + */ + void SetTxPower (double pow); + + /** + * \return the transmission power in dBm + */ + double GetTxPower () const; /** * \brief Queue the MAC PDU to be sent diff --git a/src/lte/model/lte-phy.cc b/src/lte/model/lte-phy.cc index 89360a85d..da15d78c2 100644 --- a/src/lte/model/lte-phy.cc +++ b/src/lte/model/lte-phy.cc @@ -183,22 +183,6 @@ LtePhy::GetUplinkSubChannels (void) return m_listOfUplinkSubchannel; } - -void -LtePhy::SetTxPower (double pw) -{ - NS_LOG_FUNCTION (this << pw); - m_txPower = pw; -} - - -double -LtePhy::GetTxPower (void) -{ - NS_LOG_FUNCTION (this); - return m_txPower; -} - void LtePhy::SetTti (double tti) { diff --git a/src/lte/model/lte-phy.h b/src/lte/model/lte-phy.h index 8be79ce2d..1d0c5bdad 100644 --- a/src/lte/model/lte-phy.h +++ b/src/lte/model/lte-phy.h @@ -136,17 +136,6 @@ public: */ virtual Ptr CreateTxPowerSpectralDensity () = 0; - /** - * \brief Set the power transmisison, expressed in dBm - * \param pw the power transmission - */ - void SetTxPower (double pw); - /** - * \brief Get the power transmission, expressed in dBm - * \return the power transmission - */ - double GetTxPower (void); - void DoDispose (); /** diff --git a/src/lte/model/lte-ue-phy.cc b/src/lte/model/lte-ue-phy.cc index e1a9b9200..01543b5aa 100644 --- a/src/lte/model/lte-ue-phy.cc +++ b/src/lte/model/lte-ue-phy.cc @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "lte-ue-phy.h" #include "lte-enb-phy.h" #include "lte-net-device.h" @@ -124,6 +124,12 @@ LteUePhy::GetTypeId (void) static TypeId tid = TypeId ("ns3::LteUePhy") .SetParent () .AddConstructor () + .AddAttribute ("TxPower", + "Transmission power in dBm", + DoubleValue (10.0), + MakeDoubleAccessor (&LteUePhy::SetTxPower, + &LteUePhy::GetTxPower), + MakeDoubleChecker ()) ; return tid; } @@ -143,6 +149,19 @@ LteUePhy::GetLteUePhySapProvider () return (m_uePhySapProvider); } +void +LteUePhy::SetTxPower (double pow) +{ + NS_LOG_FUNCTION (this << pow); + m_txPower = pow; +} + +double +LteUePhy::GetTxPower () const +{ + NS_LOG_FUNCTION (this); + return m_txPower; +} void LteUePhy::DoSendMacPdu (Ptr p) diff --git a/src/lte/model/lte-ue-phy.h b/src/lte/model/lte-ue-phy.h index 2a5e044f4..65f9510df 100644 --- a/src/lte/model/lte-ue-phy.h +++ b/src/lte/model/lte-ue-phy.h @@ -66,6 +66,17 @@ public: */ void SetLteUePhySapUser (LteUePhySapUser* s); + + /** + * \param pw the transmission power in dBm + */ + void SetTxPower (double pow); + + /** + * \return the transmission power in dBm + */ + double GetTxPower () const; + /** * \brief Queue the MAC PDU to be sent * \param p the MAC PDU to sent