A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lena-fading.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Marco Miozzo <marco.miozzo@cttc.es>
7 */
8
9#include "ns3/config-store.h"
10#include "ns3/core-module.h"
11#include "ns3/lte-module.h"
12#include "ns3/mobility-module.h"
13#include "ns3/network-module.h"
14#include <ns3/buildings-helper.h>
15#include <ns3/string.h>
16
17#include <fstream>
18// #include "ns3/gtk-config-store.h"
19
20using namespace ns3;
21
22int
23main(int argc, char* argv[])
24{
25 CommandLine cmd(__FILE__);
26 cmd.Parse(argc, argv);
27
28 // to save a template default attribute file run it like this:
29 // ./ns3 run src/lte/examples/lena-first-sim --command-template="%s
30 // --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Save
31 // --ns3::ConfigStore::FileFormat=RawText"
32 //
33 // to load a previously created default attribute file
34 // ./ns3 run src/lte/examples/lena-first-sim --command-template="%s
35 // --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Load
36 // --ns3::ConfigStore::FileFormat=RawText"
37
38 // ConfigStore inputConfig;
39 // inputConfig.ConfigureDefaults ();
40
41 // parse again so you can override default values from the command line
42 // cmd.Parse (argc, argv);
43
45 // Uncomment to enable logging
46 // lteHelper->EnableLogComponents ();
47
48 lteHelper->SetAttribute("FadingModel", StringValue("ns3::TraceFadingLossModel"));
49
50 std::ifstream ifTraceFile;
51 ifTraceFile.open("../../src/lte/model/fading-traces/fading_trace_EPA_3kmph.fad",
52 std::ifstream::in);
53 if (ifTraceFile.good())
54 {
55 // script launched by test.py
56 lteHelper->SetFadingModelAttribute(
57 "TraceFilename",
58 StringValue("../../src/lte/model/fading-traces/fading_trace_EPA_3kmph.fad"));
59 }
60 else
61 {
62 // script launched as an example
63 lteHelper->SetFadingModelAttribute(
64 "TraceFilename",
65 StringValue("src/lte/model/fading-traces/fading_trace_EPA_3kmph.fad"));
66 }
67
68 // these parameters have to be set only in case of the trace format
69 // differs from the standard one, that is
70 // - 10 seconds length trace
71 // - 10,000 samples
72 // - 0.5 seconds for window size
73 // - 100 RB
74 lteHelper->SetFadingModelAttribute("TraceLength", TimeValue(Seconds(10.0)));
75 lteHelper->SetFadingModelAttribute("SamplesNum", UintegerValue(10000));
76 lteHelper->SetFadingModelAttribute("WindowSize", TimeValue(Seconds(0.5)));
77 lteHelper->SetFadingModelAttribute("RbNum", UintegerValue(100));
78
79 // Create Nodes: eNodeB and UE
80 NodeContainer enbNodes;
81 NodeContainer ueNodes;
82 enbNodes.Create(1);
83 ueNodes.Create(1);
84
85 // Install Mobility Model
87 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
88 mobility.Install(enbNodes);
90 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
91 mobility.Install(ueNodes);
93
94 // Create Devices and install them in the Nodes (eNB and UE)
95 NetDeviceContainer enbDevs;
96 NetDeviceContainer ueDevs;
97 enbDevs = lteHelper->InstallEnbDevice(enbNodes);
98 ueDevs = lteHelper->InstallUeDevice(ueNodes);
99
100 // Attach a UE to a eNB
101 lteHelper->Attach(ueDevs, enbDevs.Get(0));
102
103 // Activate an EPS bearer
105 EpsBearer bearer(q);
106 lteHelper->ActivateDataRadioBearer(ueDevs, bearer);
107
108 Simulator::Stop(Seconds(0.005));
109
111
112 // GtkConfigStore config;
113 // config.ConfigureAttributes ();
114
116 return 0;
117}
static void Install(Ptr< Node > node)
Install the MobilityBuildingInfo to a node.
Parse command-line arguments.
This class contains the specification of EPS Bearers.
Definition eps-bearer.h:80
Qci
QoS Class Indicator.
Definition eps-bearer.h:95
@ GBR_CONV_VOICE
GBR Conversational Voice.
Definition eps-bearer.h:96
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
Hold variables of type string.
Definition string.h:45
Hold an unsigned integer type.
Definition uinteger.h:34
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
Every class exported by the ns3 library is enclosed in the ns3 namespace.
mobility
Definition third.py:92