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