A Discrete-Event Network Simulator
API
lena-cc-helper.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Danilo Abrignani <danilo.abrignani@unibo.it>
18  */
19 
20 #include "ns3/cc-helper.h"
21 #include "ns3/component-carrier.h"
22 #include "ns3/core-module.h"
23 #include <ns3/buildings-helper.h>
24 // #include "ns3/config-store.h"
25 
26 using namespace ns3;
27 
28 void Print(ComponentCarrier cc);
29 
30 int
31 main(int argc, char* argv[])
32 {
33  CommandLine cmd(__FILE__);
34  cmd.Parse(argc, argv);
35 
36  Config::SetDefault("ns3::ComponentCarrier::UlBandwidth", UintegerValue(50));
37  Config::SetDefault("ns3::ComponentCarrier::PrimaryCarrier", BooleanValue(true));
38 
39  // Parse again so you can override default values from the command line
40  cmd.Parse(argc, argv);
41 
42  Ptr<CcHelper> cch = CreateObject<CcHelper>();
43  cch->SetNumberOfComponentCarriers(2);
44 
45  std::map<uint8_t, ComponentCarrier> ccm = cch->EquallySpacedCcs();
46 
47  std::cout << " CcMap size " << ccm.size() << std::endl;
48  for (auto it = ccm.begin(); it != ccm.end(); it++)
49  {
50  Print(it->second);
51  }
52 
53  Simulator::Stop(Seconds(1.05));
54 
56 
57  // GtkConfigStore config;
58  // config.ConfigureAttributes ();
59 
61  return 0;
62 }
63 
64 void
66 {
67  std::cout << " UlBandwidth " << uint16_t(cc.GetUlBandwidth()) << " DlBandwidth "
68  << uint16_t(cc.GetDlBandwidth()) << " Dl Earfcn " << cc.GetDlEarfcn() << " Ul Earfcn "
69  << cc.GetUlEarfcn() << " - Is this the Primary Channel? " << cc.IsPrimary()
70  << std::endl;
71 }
Parse command-line arguments.
Definition: command-line.h:232
ComponentCarrier Object, it defines a single Carrier This is the parent class for both ComponentCarri...
uint32_t GetDlEarfcn() const
uint16_t GetUlBandwidth() const
uint16_t GetDlBandwidth() const
uint32_t GetUlEarfcn() const
bool IsPrimary() const
Checks if the carrier is the primary carrier.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static void Run()
Run the simulation.
Definition: simulator.cc:178
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:186
Hold an unsigned integer type.
Definition: uinteger.h:45
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:890
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
void Print(ComponentCarrier cc)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
cmd
Definition: second.py:40