1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3 * Copyright (c) 2011-2018 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: Manuel Requena <manuel.requena@cttc.es>
19 */
20
21 #include "ns3/core-module.h"
22 #include "ns3/network-module.h"
23 #include "ns3/mobility-module.h"
24 #include "ns3/lte-module.h"
25 #include "ns3/config-store.h"
26 #include <ns3/buildings-helper.h>
27 //#include "ns3/gtk-config-store.h"
28
29 using namespace ns3;
30
main(int argc,char * argv[])31 int main (int argc, char *argv[])
32 {
33 Time simTime = MilliSeconds (1050);
34 bool useCa = false;
35
36 CommandLine cmd (__FILE__);
37 cmd.AddValue ("simTime", "Total duration of the simulation", simTime);
38 cmd.AddValue ("useCa", "Whether to use carrier aggregation.", useCa);
39 cmd.Parse (argc, argv);
40
41 // to save a template default attribute file run it like this:
42 // ./waf --command-template="%s --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Save --ns3::ConfigStore::FileFormat=RawText" --run src/lte/examples/lena-simple
43 //
44 // to load a previously created default attribute file
45 // ./waf --command-template="%s --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Load --ns3::ConfigStore::FileFormat=RawText" --run src/lte/examples/lena-simple
46
47 ConfigStore inputConfig;
48 inputConfig.ConfigureDefaults ();
49
50 // Parse again so you can override default values from the command line
51 cmd.Parse (argc, argv);
52
53 if (useCa)
54 {
55 Config::SetDefault ("ns3::LteHelper::UseCa", BooleanValue (useCa));
56 Config::SetDefault ("ns3::LteHelper::NumberOfComponentCarriers", UintegerValue (2));
57 Config::SetDefault ("ns3::LteHelper::EnbComponentCarrierManager", StringValue ("ns3::RrComponentCarrierManager"));
58 }
59
60 Ptr<LteHelper> lteHelper = CreateObject<LteHelper> ();
61
62 // Uncomment to enable logging
63 // lteHelper->EnableLogComponents ();
64
65 // Create Nodes: eNodeB and UE
66 NodeContainer enbNodes;
67 NodeContainer ueNodes;
68 enbNodes.Create (1);
69 ueNodes.Create (1);
70
71 // Install Mobility Model
72 MobilityHelper mobility;
73 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
74 mobility.Install (enbNodes);
75 BuildingsHelper::Install (enbNodes);
76 mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
77 mobility.Install (ueNodes);
78 BuildingsHelper::Install (ueNodes);
79
80 // Create Devices and install them in the Nodes (eNB and UE)
81 NetDeviceContainer enbDevs;
82 NetDeviceContainer ueDevs;
83 // Default scheduler is PF, uncomment to use RR
84 //lteHelper->SetSchedulerType ("ns3::RrFfMacScheduler");
85
86 enbDevs = lteHelper->InstallEnbDevice (enbNodes);
87 ueDevs = lteHelper->InstallUeDevice (ueNodes);
88
89 // Attach a UE to a eNB
90 lteHelper->Attach (ueDevs, enbDevs.Get (0));
91
92 // Activate a data radio bearer
93 enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
94 EpsBearer bearer (q);
95 lteHelper->ActivateDataRadioBearer (ueDevs, bearer);
96 lteHelper->EnableTraces ();
97
98 Simulator::Stop (simTime);
99 Simulator::Run ();
100
101 // GtkConfigStore config;
102 // config.ConfigureAttributes ();
103
104 Simulator::Destroy ();
105 return 0;
106 }
107