A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
buildings-pathloss-profiler.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 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: Marco Miozzo <marco.miozzo@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/config-store.h"
25
#include <ns3/buildings-helper.h>
26
#include <ns3/hybrid-buildings-propagation-loss-model.h>
27
#include <ns3/constant-position-mobility-model.h>
28
29
#include <iomanip>
30
#include <string>
31
#include <vector>
32
33
using namespace
ns3
;
34
using
std::vector;
35
36
int
37
main (
int
argc,
char
*argv[])
38
{
39
40
double
hEnb = 30.0;
41
double
hUe = 1.0;
42
bool
enbIndoor =
false
;
43
bool
ueIndoor =
false
;
44
CommandLine
cmd
(__FILE__);
45
46
cmd
.AddValue(
"hEnb"
,
"Height of the eNB"
, hEnb);
47
cmd
.AddValue(
"hUe"
,
"Height of UE"
, hUe);
48
cmd
.AddValue(
"enbIndoor"
,
"Boolean for eNB Indoor/Outdoor selection"
, enbIndoor);
49
cmd
.AddValue(
"ueIndoor"
,
"Boolean for UE Indoor/Outdoor selection"
, ueIndoor);
50
cmd
.Parse(argc, argv);
51
52
ConfigStore
inputConfig;
53
inputConfig.
ConfigureDefaults
();
54
55
56
// parse again so you can override default values from the command line
57
cmd
.Parse (argc, argv);
58
59
60
std::ofstream outFile;
61
outFile.open (
"buildings-pathloss-profiler.out"
);
62
if
(!outFile.is_open ())
63
{
64
NS_FATAL_ERROR
(
"Can't open output file"
);
65
}
66
67
Ptr<ConstantPositionMobilityModel>
mmEnb = CreateObject<ConstantPositionMobilityModel> ();
68
mmEnb->
SetPosition
(Vector (0.0, 0.0, hEnb));
69
if
(enbIndoor)
70
{
71
Ptr<Building>
building1 = CreateObject<Building> (-2, 2, -2, 2, 0.0, 20.0);
72
building1->
SetBuildingType
(
Building::Residential
);
73
building1->
SetExtWallsType
(
Building::ConcreteWithWindows
);
74
}
75
76
Ptr<MobilityBuildingInfo>
buildingInfoEnb = CreateObject<MobilityBuildingInfo> ();
77
mmEnb->
AggregateObject
(buildingInfoEnb);
// operation usually done by BuildingsHelper::Install
78
buildingInfoEnb->
MakeConsistent
(mmEnb);
79
80
Ptr<HybridBuildingsPropagationLossModel>
propagationLossModel = CreateObject<HybridBuildingsPropagationLossModel> ();
81
// cancel shadowing effect
82
propagationLossModel->
SetAttribute
(
"ShadowSigmaOutdoor"
,
DoubleValue
(0.0));
83
propagationLossModel->
SetAttribute
(
"ShadowSigmaIndoor"
,
DoubleValue
(0.0));
84
propagationLossModel->
SetAttribute
(
"ShadowSigmaExtWalls"
,
DoubleValue
(0.0));
85
86
// propagationLossModel->SetAttribute ("Los2NlosThr", DoubleValue (1550.0));
87
88
//for (uint8_t i = 0; i < 23; i++)
89
for
(uint32_t i = 1; i < 2300; i++)
90
{
91
Ptr<ConstantPositionMobilityModel>
mmUe = CreateObject<ConstantPositionMobilityModel> ();
92
mmUe->
SetPosition
(Vector (i, 0.0, hUe));
93
Ptr<MobilityBuildingInfo>
buildingInfoUe = CreateObject<MobilityBuildingInfo> ();
94
mmUe->
AggregateObject
(buildingInfoUe);
// operation usually done by BuildingsHelper::Install
95
buildingInfoUe->
MakeConsistent
(mmUe);
96
double
loss = propagationLossModel->
GetLoss
(mmEnb, mmUe);
97
outFile << i <<
"\t"
98
<< loss
99
<< std::endl;
100
}
101
102
Simulator::Destroy
();
103
104
}
ns3::CommandLine
Parse command-line arguments.
Definition:
command-line.h:228
ns3::Building::SetExtWallsType
void SetExtWallsType(Building::ExtWallsType_t t)
Definition:
building.cc:153
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Building::Residential
@ Residential
Definition:
building.h:48
ns3::MobilityModel::SetPosition
void SetPosition(const Vector &position)
Definition:
mobility-model.cc:88
ns3::ObjectBase::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition:
object-base.cc:185
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition:
double.h:41
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition:
fatal-error.h:165
ns3::MobilityBuildingInfo::MakeConsistent
void MakeConsistent(Ptr< MobilityModel > mm)
Make the given mobility model consistent, by determining whether its position falls inside any of the...
Definition:
mobility-building-info.cc:170
ns3::Building::SetBuildingType
void SetBuildingType(Building::BuildingType_t t)
Definition:
building.cc:146
ns3::Object::AggregateObject
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition:
object.cc:252
ns3::ConfigStore
Introspection did not find any typical Config paths.
Definition:
config-store.h:60
second.cmd
cmd
Definition:
second.py:35
ns3::ConfigStore::ConfigureDefaults
void ConfigureDefaults(void)
Configure the default values.
Definition:
config-store.cc:185
ns3::Building::ConcreteWithWindows
@ ConcreteWithWindows
Definition:
building.h:52
ns3::Simulator::Destroy
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition:
simulator.cc:136
ns3::HybridBuildingsPropagationLossModel::GetLoss
virtual double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Definition:
hybrid-buildings-propagation-loss-model.cc:143
src
buildings
examples
buildings-pathloss-profiler.cc
Generated on Fri Oct 1 2021 17:02:55 for ns-3 by
1.8.20