added TX power attribute
authorNicola Baldo <nbaldo@cttc.es>
Wed, 06 Apr 2011 14:48:55 +0200
changeset 7949 3bf9450ac03f
parent 7946 ab62b878fb84
child 7950 4a4009fdd6b8
added TX power attribute
src/lte/model/lte-enb-phy.cc
src/lte/model/lte-enb-phy.h
src/lte/model/lte-phy.cc
src/lte/model/lte-phy.h
src/lte/model/lte-ue-phy.cc
src/lte/model/lte-ue-phy.h
--- a/src/lte/model/lte-enb-phy.cc	Wed Apr 06 10:15:28 2011 +0200
+++ b/src/lte/model/lte-enb-phy.cc	Wed Apr 06 14:48:55 2011 +0200
@@ -23,7 +23,10 @@
 #include <ns3/log.h>
 #include <math.h>
 #include <ns3/simulator.h>
-#include "ns3/spectrum-error-model.h"
+#include <ns3/attribute-accessor-helper.h>
+#include <ns3/double.h>
+
+
 #include "lte-enb-phy.h"
 #include "lte-net-device.h"
 #include "lte-spectrum-value-helper.h"
@@ -112,6 +115,12 @@
   static TypeId tid = TypeId ("ns3::LteEnbPhy")
     .SetParent<LtePhy> ()
     .AddConstructor<LteEnbPhy> ()
+    .AddAttribute ("TxPower",
+                   "Transmission power in dBm",
+                   DoubleValue (30.0),
+                   MakeDoubleAccessor (&LteEnbPhy::SetTxPower, 
+                                       &LteEnbPhy::GetTxPower),
+                   MakeDoubleChecker<double> ())
   ;
   return tid;
 }
@@ -142,7 +151,19 @@
   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<LteUePhy> phy)
--- a/src/lte/model/lte-enb-phy.h	Wed Apr 06 10:15:28 2011 +0200
+++ b/src/lte/model/lte-enb-phy.h	Wed Apr 06 14:48:55 2011 +0200
@@ -67,6 +67,15 @@
   */
   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
--- a/src/lte/model/lte-phy.cc	Wed Apr 06 10:15:28 2011 +0200
+++ b/src/lte/model/lte-phy.cc	Wed Apr 06 14:48:55 2011 +0200
@@ -183,22 +183,6 @@
   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)
 {
--- a/src/lte/model/lte-phy.h	Wed Apr 06 10:15:28 2011 +0200
+++ b/src/lte/model/lte-phy.h	Wed Apr 06 14:48:55 2011 +0200
@@ -136,17 +136,6 @@
    */
   virtual Ptr<SpectrumValue> 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 ();
 
   /**
--- a/src/lte/model/lte-ue-phy.cc	Wed Apr 06 10:15:28 2011 +0200
+++ b/src/lte/model/lte-ue-phy.cc	Wed Apr 06 14:48:55 2011 +0200
@@ -24,7 +24,7 @@
 #include <ns3/log.h>
 #include <math.h>
 #include <ns3/simulator.h>
-#include <ns3/spectrum-error-model.h>
+#include <ns3/double.h>
 #include "lte-ue-phy.h"
 #include "lte-enb-phy.h"
 #include "lte-net-device.h"
@@ -124,6 +124,12 @@
   static TypeId tid = TypeId ("ns3::LteUePhy")
     .SetParent<LtePhy> ()
     .AddConstructor<LteUePhy> ()
+    .AddAttribute ("TxPower",
+                   "Transmission power in dBm",
+                   DoubleValue (10.0),
+                   MakeDoubleAccessor (&LteUePhy::SetTxPower, 
+                                       &LteUePhy::GetTxPower),
+                   MakeDoubleChecker<double> ())
   ;
   return tid;
 }
@@ -143,6 +149,19 @@
   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<Packet> p)
--- a/src/lte/model/lte-ue-phy.h	Wed Apr 06 10:15:28 2011 +0200
+++ b/src/lte/model/lte-ue-phy.h	Wed Apr 06 14:48:55 2011 +0200
@@ -66,6 +66,17 @@
   */
   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