How to add frequency bands to and lte-model

928 views
Skip to first unread message

Inics

unread,
Feb 11, 2012, 3:54:21 AM2/11/12
to ns-3-users, Nicola, Suresh, Mitch Watrous
Hi Guys,
I need some help with creating frequency bands for ns3 enNode b in lte-
Models for a project.
I am modifying the lte-device class and will like to add frequency
bands. I have been told that the spectrum model is included in the lte-
model.....

Any help is appreciated........

Regards,
Dom

Infiel

unread,
Feb 13, 2012, 3:46:04 AM2/13/12
to ns-3-...@googlegroups.com, Nicola, Suresh, Mitch Watrous
Hi,

If I understand you correctly, you should start your investigations from lte-spectrum-value-helper class (in lte/models). Here you can find a best start point for RB creation, frequency assignment etc.

Inics

unread,
Feb 14, 2012, 1:38:50 AM2/14/12
to ns-3-users
Hi Infel,
Sorry, I thought I had replied to you already via my gmail but it came
across as if I had not done so going through the group posts.
First of all thank you for your advice. I will be creating the
frequencies and try to tie it up with the enNodeB.
Will let you know of the outcome.

Thanks and Regards,
Inics

Inics

unread,
Feb 15, 2012, 1:40:07 AM2/15/12
to ns-3-users
Hi Infel et al,

Please have a look at my script and see where I'm going wrong and what
has to be added in order to achieve the function I want.
I have modified the lte-device.cc class slightly to get it to do what
I want it to do but at the moment, I have tried to add the frequency
bands but don't know how to give it to the enNodeB and how the UE will
request for it.

Please I appreciate any help and contribution..........


//      +-----+    +-----+    +-----+
//      |prUE0|    |crUE1|    |crUE2|
//      +-----+    +-----+    +-----+
//     10.1.1.1   10.1.1.2   10.1.1.3
//      --------  --------    -------
//        ((*))    ((*))       ((*))
//
//                  10.1.1.4
//               +------------+
//               |eNB         | ==((*))
//               +------------+




#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/applications-module.h"
#include "ns3/mobility-module.h"
#include "ns3/config-store-module.h"
#include "ns3/internet-module.h"
#include "ns3/lte-module.h"
#include <iostream>
#include "ns3/global-route-manager.h"
#include <spectrum-model.h>
#include <lte-spectrum-value-helper.h>








NS_LOG_COMPONENT_DEFINE ("lte-device");




using namespace ns3;








int main (int argc, char *argv[])
{
  // default values
  int nbUE = 3;




  LteHelper lte;




  //lte.EnableLogComponents ();
  LogComponentEnable ("UdpClient", LOG_LEVEL_INFO);
  LogComponentEnable ("UdpServer", LOG_LEVEL_INFO);
  NS_LOG_INFO("Spectrum Simulation");








  // CREATE NODE CONTAINER AND CREATE LTE NODES
  NodeContainer ueNodes;
  NodeContainer enbNodes;
  ueNodes.Create (nbUE);
  enbNodes.Create (1);








  // CREATE DEVICE CONTAINER, INSTALL DEVICE TO NODE
  NetDeviceContainer ueDevs, enbDevs;
  ueDevs = lte.Install (ueNodes,
LteHelper::DEVICE_TYPE_USER_EQUIPMENT);
  enbDevs = lte.Install (enbNodes, LteHelper::DEVICE_TYPE_ENODEB);












  // INSTALL INTERNET STACKS
  InternetStackHelper stack;
  stack.Install (ueNodes);
  stack.Install (enbNodes);
  Ipv4AddressHelper address;
  address.SetBase ("10.1.1.0", "255.255.255.0");
  Ipv4InterfaceContainer UEinterfaces = address.Assign (ueDevs);
  Ipv4InterfaceContainer ENBinterface = address.Assign (enbDevs);












  // MANAGE LTE NET DEVICES
  Ptr<EnbNetDevice> enb;
  enb = enbDevs.Get (0)->GetObject<EnbNetDevice> ();




  std::vector<Ptr<UeNetDevice> > ue (nbUE);
  for (int i = 0; i < nbUE; i++)
    {
      ue.at (i) = ueDevs.Get (i)->GetObject<UeNetDevice> ();
      lte.RegisterUeToTheEnb (ue.at (i), enb);
    }












  // CONFIGURE DL and UL SUB CHANNELS
  // Define a list of sub channels for the downlink
  std::vector<int> dlSubChannels;
  for (int i = 0; i < 25; i++)
    {
      dlSubChannels.push_back (i);
    }
  // Define a list of sub channels for the uplink
  std::vector<int> ulSubChannels;
  for (int i = 50; i < 100; i++)
    {
      ulSubChannels.push_back (i);
    }




  enb->GetPhy ()->SetDownlinkSubChannels (dlSubChannels);
  enb->GetPhy ()->SetUplinkSubChannels (ulSubChannels);




  for (int i = 0; i < nbUE; i++)
    {
      ue.at (i)->GetPhy ()->SetDownlinkSubChannels (dlSubChannels);
      ue.at (i)->GetPhy ()->SetUplinkSubChannels (ulSubChannels);
    }








  // CONFIGURE MOBILITY
  Ptr<ConstantPositionMobilityModel> enbMobility =
CreateObject<ConstantPositionMobilityModel> ();
  enbMobility->SetPosition (Vector (0.0, 0.0, 0.0));
  lte.AddMobility (enb->GetPhy (), enbMobility);




  for (int i = 0; i < nbUE; i++)
    {
      Ptr<ConstantVelocityMobilityModel> ueMobility =
CreateObject<ConstantVelocityMobilityModel> ();
      ueMobility->SetPosition (Vector (30.0, 0.0, 0.0));
      ueMobility->SetVelocity (Vector (30.0, 0.0, 0.0));




      lte.AddMobility (ue.at (i)->GetPhy (), ueMobility);




      lte.AddDownlinkChannelRealization (enbMobility, ueMobility,
ue.at (i)->GetPhy ());
    }








  // CONGIFURE CLIENT SERVER APPLICATION
  UdpServerHelper udpServer;
  ApplicationContainer serverApp;
  UdpClientHelper udpClient;
  ApplicationContainer clientApp;




  udpServer = UdpServerHelper (100);
  serverApp = udpServer.Install (ueNodes.Get (0));
  serverApp.Start (Seconds (0.02));
  serverApp.Stop (Seconds (2));




  udpClient = UdpClientHelper (UEinterfaces.GetAddress (0), 100);
  udpClient.SetAttribute ("MaxPackets", UintegerValue (1200));
  udpClient.SetAttribute ("Interval", TimeValue (Seconds (0.12)));
  udpClient.SetAttribute ("PacketSize", UintegerValue (800));
  clientApp = udpClient.Install (enbNodes.Get (0));
  clientApp.Start (Seconds (0.01));
  clientApp.Stop (Seconds (2));








  //CREATE RADIO BEARER
  Ptr<RadioBearerInstance> bearer = CreateObject<RadioBearerInstance>
();
  bearer->SetBearerDirection (RadioBearerInstance::DIRECTION_TYPE_DL);
  bearer->SetBearerType (RadioBearerInstance::BEARER_TYPE_DRB);




  IpcsClassifierRecord *ipcs = new IpcsClassifierRecord
(UEinterfaces.GetAddress (0),
                                                       
 "255.255.255.0",
                                                       
 ENBinterface.GetAddress (0),
                                                       
 "255.255.255.0",
                                                         100, 100, 0,
10000, 17, 1);
  bearer->SetIpcsClassifierRecord (ipcs);




  enb->GetRrcEntity ()->AddDownlinkNgbrBearer (bearer);




  bearer = 0;




   //CREATING THE SPECTRUM MODEL FOR THE LTE : frequency in Hz
  std::vector<double>centrefrq(5);
  centrefrq.push_back(50.00);
  centrefrq.push_back(100.00);
  centrefrq.push_back(150.00);
  centrefrq.push_back(200.00);
  centrefrq.push_back(250.00);




  Ptr<SpectrumModel> spectrums =
CreateObject<SpectrumModel>(centrefrq);
  LteSpectrumValueHelper spectrumValues;
  double power = 44;




  std::cout<<"Number of Frequency Bands"<< spectrums-
>GetNumBands()<<std::endl;
  spectrumValues.CreateDownlinkTxPowerSpectralDensity(power,
dlSubChannels);
  spectrumValues.CreateUplinkTxPowerSpectralDensity(power,
ulSubChannels);








   std::cout << "Starting simulation....." << std::endl;
   Simulator::Stop (Seconds (2.0));








  Simulator::Run ();




  Simulator::Destroy ();




  delete ipcs;




  std::cout << "Done." << std::endl;




  return 0;
}



Kind Regards,
Inics

Nicola Baldo

unread,
Feb 21, 2012, 7:23:09 AM2/21/12
to ns-3-users
Hi Inics,

I suggest you to have a look at the LteEnbNetDevice and in particular
at its attributes DlEarfcn, UlEarfcn, DlBandwidth and UlBandwidth.
These are configurable via the ns-3 attribute system and control the
frequency and bandwidth used by an eNB for operation.

Regards,

Nicola

Infiel

unread,
Feb 21, 2012, 8:01:46 AM2/21/12
to ns-3-...@googlegroups.com
Exactly, I'm also using that way, and see no point for using different. in attributes comments (and/or in spectrum value helper class) you have a references to a proper 3GPP documents where earfcn and related stuff is explained.

Dominic

unread,
Feb 21, 2012, 8:22:01 AM2/21/12
to ns-3-...@googlegroups.com
Hi Guys,
Thanks to you all... I'm now having a look at the LteEnbNetDevice attributes you indicated  its in the 3GPP docs.. i.e. the earfcn and others
I have had a look at the spectrum value helper and it does not actually help that much..........

Will post the outcome of my findings...
@Infiel, how did you implement the bands on the enNode B... I will appreciate you can run me down on the classes you used and how they were implemented..

I'm modifying the lte-device.cc class
At the moment, I haven't done much... which is why I need to know how to implement the frequency bands on the enNodeb...

Thanks and Regards,
Inics


On 21 February 2012 13:01, Infiel <pank...@gmail.com> wrote:
Exactly, I'm also using that way, and see no point for using different. in attributes comments (and/or in spectrum value helper class) you have a references to a proper 3GPP documents where earfcn and related stuff is explained.

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/w2TpZUAV9WYJ.

To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.

Infiel

unread,
Feb 21, 2012, 8:37:03 AM2/21/12
to ns-3-...@googlegroups.com
I just set the bandwidth and earfcn in LteEnbNetDevice (as Nicola Baldo said). According to LTE standards it is the only way to apply bandwidth and frequency bands to UEs and eNBs. So why I need to use other method? I you want a different bands for every eNB, you just need to change earfcn number for each etc.
If you really want, you must look on proper function in lte-spectrum-value-helper (e.g. start from GetSpectrumModel). You must examine the flow step by step how it is created.

Then, a RB allocation process (which blocks to which transmission) is done in PfFF-mac-scheduler or RR-FF-mac-scheduler. Both uplink and downlink are scheduled on the eNB side. Currently, I am trying to understand the scheduling process and to create some RB allocation visualization  (something like colorful blocks representing UE <-> RB assingment)

I you want to do that things manually - you must understand all of the code and override some methods.

Dasha Sayed

unread,
Jun 8, 2017, 3:48:32 AM6/8/17
to ns-3-users
Good morning Infiel. I understand this post is very old but I would appreciate very much if you could give me a guide on how to expand the bands for LTE in NS3. Thank you in advance!
Reply all
Reply to author
Forward
0 new messages