A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
buildings-pathloss-profiler.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 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: Marco Miozzo <marco.miozzo@cttc.es>
18 */
19
20#include "ns3/config-store.h"
21#include "ns3/core-module.h"
22#include "ns3/mobility-module.h"
23#include "ns3/network-module.h"
24#include <ns3/buildings-helper.h>
25#include <ns3/constant-position-mobility-model.h>
26#include <ns3/hybrid-buildings-propagation-loss-model.h>
27
28#include <iomanip>
29#include <string>
30#include <vector>
31
32using namespace ns3;
33using std::vector;
34
35int
36main(int argc, char* argv[])
37{
38 double hEnb = 30.0;
39 double hUe = 1.0;
40 bool enbIndoor = false;
41 bool ueIndoor = false;
42 CommandLine cmd(__FILE__);
43
44 cmd.AddValue("hEnb", "Height of the eNB", hEnb);
45 cmd.AddValue("hUe", "Height of UE", hUe);
46 cmd.AddValue("enbIndoor", "Boolean for eNB Indoor/Outdoor selection", enbIndoor);
47 cmd.AddValue("ueIndoor", "Boolean for UE Indoor/Outdoor selection", ueIndoor);
48 cmd.Parse(argc, argv);
49
50 ConfigStore inputConfig;
51 inputConfig.ConfigureDefaults();
52
53 // parse again so you can override default values from the command line
54 cmd.Parse(argc, argv);
55
56 std::ofstream outFile;
57 outFile.open("buildings-pathloss-profiler.out");
58 if (!outFile.is_open())
59 {
60 NS_FATAL_ERROR("Can't open output file");
61 }
62
63 Ptr<ConstantPositionMobilityModel> mmEnb = CreateObject<ConstantPositionMobilityModel>();
64 mmEnb->SetPosition(Vector(0.0, 0.0, hEnb));
65 if (enbIndoor)
66 {
67 Ptr<Building> building1 = CreateObject<Building>(-2, 2, -2, 2, 0.0, 20.0);
68 building1->SetBuildingType(Building::Residential);
69 building1->SetExtWallsType(Building::ConcreteWithWindows);
70 }
71
72 Ptr<MobilityBuildingInfo> buildingInfoEnb = CreateObject<MobilityBuildingInfo>();
73 mmEnb->AggregateObject(buildingInfoEnb); // operation usually done by BuildingsHelper::Install
74 buildingInfoEnb->MakeConsistent(mmEnb);
75
76 Ptr<HybridBuildingsPropagationLossModel> propagationLossModel =
77 CreateObject<HybridBuildingsPropagationLossModel>();
78 // cancel shadowing effect
79 propagationLossModel->SetAttribute("ShadowSigmaOutdoor", DoubleValue(0.0));
80 propagationLossModel->SetAttribute("ShadowSigmaIndoor", DoubleValue(0.0));
81 propagationLossModel->SetAttribute("ShadowSigmaExtWalls", DoubleValue(0.0));
82
83 // propagationLossModel->SetAttribute ("Los2NlosThr", DoubleValue (1550.0));
84
85 // for (uint8_t i = 0; i < 23; i++)
86 for (uint32_t i = 1; i < 2300; i++)
87 {
88 Ptr<ConstantPositionMobilityModel> mmUe = CreateObject<ConstantPositionMobilityModel>();
89 mmUe->SetPosition(Vector(i, 0.0, hUe));
90 Ptr<MobilityBuildingInfo> buildingInfoUe = CreateObject<MobilityBuildingInfo>();
91 mmUe->AggregateObject(buildingInfoUe); // operation usually done by BuildingsHelper::Install
92 buildingInfoUe->MakeConsistent(mmUe);
93 double loss = propagationLossModel->GetLoss(mmEnb, mmUe);
94 outFile << i << "\t" << loss << std::endl;
95 }
96
98
99 return 0;
100}
@ ConcreteWithWindows
Definition: building.h:69
Parse command-line arguments.
Definition: command-line.h:232
Introspection did not find any typical Config paths.
Definition: config-store.h:61
void ConfigureDefaults()
Configure the default values.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
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
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns cmd
Definition: second.py:40