Index: src/lte/model/component-carrier-ue.cc |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/src/lte/model/component-carrier-ue.cc |
@@ -0,0 +1,255 @@ |
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
+/* |
+ * Copyright (c) 2015 Danilo Abrignani |
+ * |
+ * This program is free software; you can redistribute it and/or modify |
+ * it under the terms of the GNU General Public License version 2 as |
+ * published by the Free Software Foundation; |
+ * |
+ * This program is distributed in the hope that it will be useful, |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ * GNU General Public License for more details. |
+ * |
+ * You should have received a copy of the GNU General Public License |
+ * along with this program; if not, write to the Free Software |
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+ * |
+ * Author: Danilo Abrignani <danilo.abrignani@unibo.it> |
+ */ |
+ |
+#include "component-carrier-ue.h" |
+#include <ns3/uinteger.h> |
+#include <ns3/boolean.h> |
+#include <ns3/simulator.h> |
+#include <ns3/log.h> |
+#include <ns3/abort.h> |
+#include <ns3/lte-ue-phy.h> |
+#include <ns3/pointer.h> |
+ |
+namespace ns3 { |
+ |
+NS_LOG_COMPONENT_DEFINE ("ComponentCarrierUe"); |
+ |
+NS_OBJECT_ENSURE_REGISTERED ( ComponentCarrierUe); |
+ |
+TypeId ComponentCarrierUe::GetTypeId (void) |
+{ |
+ static TypeId |
+ tid = |
+ TypeId ("ns3::ComponentCarrierUe") |
+ .SetParent<Object> () |
+ .AddConstructor<ComponentCarrierUe> () |
+ .AddAttribute ("UlBandwidth", |
+ "Uplink Transmission Bandwidth Configuration in number of Resource Blocks", |
+ UintegerValue (25), |
+ MakeUintegerAccessor (&ComponentCarrierUe::SetUlBandwidth, |
+ &ComponentCarrierUe::GetUlBandwidth), |
+ MakeUintegerChecker<uint8_t> ()) |
+ .AddAttribute ("DlBandwidth", |
+ "Downlink Transmission Bandwidth Configuration in number of Resource Blocks", |
+ UintegerValue (25), |
+ MakeUintegerAccessor (&ComponentCarrierUe::SetDlBandwidth, |
+ &ComponentCarrierUe::GetDlBandwidth), |
+ MakeUintegerChecker<uint8_t> ()) |
+ .AddAttribute ("DlEarfcn", |
+ "Downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) " |
+ "as per 3GPP 36.101 Section 5.7.3. ", |
+ UintegerValue (100), |
+ MakeUintegerAccessor (&ComponentCarrierUe::m_dlEarfcn), |
+ MakeUintegerChecker<uint16_t> (0, 6599)) |
+ .AddAttribute ("UlEarfcn", |
+ "Uplink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) " |
+ "as per 3GPP 36.101 Section 5.7.3. ", |
+ UintegerValue (18100), |
+ MakeUintegerAccessor (&ComponentCarrierUe::m_ulEarfcn), |
+ MakeUintegerChecker<uint16_t> (18000, 24599)) |
+ .AddAttribute ("CsgId", |
+ "The Closed Subscriber Group (CSG) identity that this eNodeB belongs to", |
+ UintegerValue (0), |
+ MakeUintegerAccessor (&ComponentCarrierUe::SetCsgId, |
+ &ComponentCarrierUe::GetCsgId), |
+ MakeUintegerChecker<uint32_t> ()) |
+ .AddAttribute ("CsgIndication", |
+ "If true, only UEs which are members of the CSG (i.e. same CSG ID) " |
+ "can gain access to the eNodeB, therefore enforcing closed access mode. " |
+ "Otherwise, the eNodeB operates as a non-CSG cell and implements open access mode.", |
+ BooleanValue (false), |
+ MakeBooleanAccessor (&ComponentCarrierUe::SetCsgIndication, |
+ &ComponentCarrierUe::GetCsgIndication), |
+ MakeBooleanChecker ()) |
+ .AddAttribute ("PrimaryCarrier", |
+ "If true, this Carrier Component will be the Primary Carrier Component (PCC) " |
+ "Only one PCC per eNodeB is (currently) allowed", |
+ BooleanValue (false), |
+ MakeBooleanAccessor (&ComponentCarrierUe::SetPrimaryCarrier, |
+ &ComponentCarrierUe::GetPrimaryCarrier), |
+ MakeBooleanChecker ()) |
+ .AddAttribute ("LteUePhy", |
+ "The PHY associated to this EnbNetDevice", |
+ PointerValue (), |
+ MakePointerAccessor (&ComponentCarrierUe::m_phy), |
+ MakePointerChecker <LteUePhy> ()) |
+ ; |
+ return tid; |
+} |
+ComponentCarrierUe::ComponentCarrierUe () |
+ : m_isConstructed (false) |
+{ |
+ NS_LOG_FUNCTION (this); |
+} |
+ |
+ComponentCarrierUe::~ComponentCarrierUe (void) |
+{ |
+ NS_LOG_FUNCTION (this); |
+} |
+ |
+void |
+ComponentCarrierUe::DoDispose () |
+{ |
+ NS_LOG_FUNCTION (this); |
+ m_phy->Dispose (); |
+ m_phy = 0; |
+ |
+ Object::DoDispose (); |
+} |
+ |
+uint8_t |
+ComponentCarrierUe::GetUlBandwidth () const |
+{ |
+ return m_ulBandwidth; |
+} |
+ |
+void |
+ComponentCarrierUe::SetUlBandwidth (uint8_t bw) |
+{ |
+ NS_LOG_FUNCTION (this << uint16_t (bw)); |
+ switch (bw) |
+ { |
+ case 6: |
+ case 15: |
+ case 25: |
+ case 50: |
+ case 75: |
+ case 100: |
+ m_ulBandwidth = bw; |
+ break; |
+ |
+ default: |
+ NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw); |
+ break; |
+ } |
+} |
+ |
+uint8_t |
+ComponentCarrierUe::GetDlBandwidth () const |
+{ |
+ return m_dlBandwidth; |
+} |
+ |
+void |
+ComponentCarrierUe::SetDlBandwidth (uint8_t bw) |
+{ |
+ NS_LOG_FUNCTION (this << uint16_t (bw)); |
+ switch (bw) |
+ { |
+ case 6: |
+ case 15: |
+ case 25: |
+ case 50: |
+ case 75: |
+ case 100: |
+ m_dlBandwidth = bw; |
+ break; |
+ |
+ default: |
+ NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw); |
+ break; |
+ } |
+} |
+ |
+uint16_t |
+ComponentCarrierUe::GetDlEarfcn () const |
+{ |
+ return m_dlEarfcn; |
+} |
+ |
+void |
+ComponentCarrierUe::SetDlEarfcn (uint16_t earfcn) |
+{ |
+ NS_LOG_FUNCTION (this << earfcn); |
+ m_dlEarfcn = earfcn; |
+} |
+ |
+uint16_t |
+ComponentCarrierUe::GetUlEarfcn () const |
+{ |
+ return m_ulEarfcn; |
+} |
+ |
+void |
+ComponentCarrierUe::SetUlEarfcn (uint16_t earfcn) |
+{ |
+ NS_LOG_FUNCTION (this << earfcn); |
+ m_ulEarfcn = earfcn; |
+} |
+ |
+uint32_t |
+ComponentCarrierUe::GetCsgId () const |
+{ |
+ return m_csgId; |
+} |
+ |
+void |
+ComponentCarrierUe::SetCsgId (uint32_t csgId) |
+{ |
+ NS_LOG_FUNCTION (this << csgId); |
+ m_csgId = csgId; |
+ // UpdateConfig (); // I guess it is needed to propagate the change to RRC level |
+} |
+ |
+bool |
+ComponentCarrierUe::GetCsgIndication () const |
+{ |
+ return m_csgIndication; |
+} |
+ |
+void |
+ComponentCarrierUe::SetCsgIndication (bool csgIndication) |
+{ |
+ NS_LOG_FUNCTION (this << csgIndication); |
+ m_csgIndication = csgIndication; |
+ // UpdateConfig (); // I guess it is needed to propagate the change to RRC level |
+} |
+ |
+bool |
+ComponentCarrierUe::GetPrimaryCarrier () const |
+{ |
+ return m_primaryCarrier; |
+} |
+ |
+void |
+ComponentCarrierUe::SetPrimaryCarrier (bool primaryCarrier) |
+{ |
+ NS_LOG_FUNCTION (this << primaryCarrier); |
+ m_primaryCarrier = primaryCarrier; |
+ // UpdateConfig (); // I guess it is needed to propagate the change to RRC level |
+} |
+ |
+void |
+ComponentCarrierUe::DoInitialize (void) |
+{ |
+ NS_LOG_FUNCTION (this); |
+ m_isConstructed = true; |
+ m_phy->Initialize (); |
+} |
+ |
+Ptr<LteUePhy> |
+ComponentCarrierUe::GetPhy () |
+{ |
+ return m_phy; |
+} |
+ |
+} // namespace ns3 |
+ |
+ |