A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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/lte-module.h"
25
#include "ns3/config-store.h"
26
#include <ns3/buildings-helper.h>
27
#include <ns3/hybrid-buildings-propagation-loss-model.h>
28
#include <ns3/constant-position-mobility-model.h>
29
30
#include <iomanip>
31
#include <string>
32
#include <vector>
33
34
using namespace
ns3;
35
using
std::vector;
36
37
int
38
main
(
int
argc,
char
*argv[])
39
{
40
41
double
hEnb = 30.0;
42
double
hUe = 1.0;
43
bool
enbIndoor =
false
;
44
bool
ueIndoor =
false
;
45
CommandLine
cmd;
46
47
cmd.
AddValue
(
"hEnb"
,
"Height of the eNB"
, hEnb);
48
cmd.
AddValue
(
"hUe"
,
"Height of UE"
, hUe);
49
cmd.
AddValue
(
"enbIndoor"
,
"Boolean for eNB Indoor/Outdoor selection"
, enbIndoor);
50
cmd.
AddValue
(
"ueIndoor"
,
"Boolean for UE Indoor/Outdoor selection"
, ueIndoor);
51
cmd.
Parse
(argc, argv);
52
53
ConfigStore
inputConfig;
54
inputConfig.
ConfigureDefaults
();
55
56
57
// parse again so you can override default values from the command line
58
cmd.
Parse
(argc, argv);
59
60
61
std::ofstream outFile;
62
outFile.open (
"buildings-pathloss-profiler.out"
);
63
if
(!outFile.is_open ())
64
{
65
NS_FATAL_ERROR
(
"Can't open output file"
);
66
}
67
68
Ptr<ConstantPositionMobilityModel>
mmEnb = CreateObject<ConstantPositionMobilityModel> ();
69
mmEnb->
SetPosition
(
Vector
(0.0, 0.0, hEnb));
70
if
(enbIndoor)
71
{
72
Ptr<Building>
building1 = CreateObject<Building> (-2, 2, -2, 2, 0.0, 20.0);
73
building1->
SetBuildingType
(
Building::Residential
);
74
building1->
SetExtWallsType
(
Building::ConcreteWithWindows
);
75
}
76
77
Ptr<MobilityBuildingInfo>
buildingInfoEnb = CreateObject<MobilityBuildingInfo> ();
78
mmEnb->
AggregateObject
(buildingInfoEnb);
// operation usually done by BuildingsHelper::Install
79
BuildingsHelper::MakeConsistent
(mmEnb);
80
81
Ptr<HybridBuildingsPropagationLossModel>
propagationLossModel = CreateObject<HybridBuildingsPropagationLossModel> ();
82
// cancel shadowing effect
83
propagationLossModel->
SetAttribute
(
"ShadowSigmaOutdoor"
,
DoubleValue
(0.0));
84
propagationLossModel->
SetAttribute
(
"ShadowSigmaIndoor"
,
DoubleValue
(0.0));
85
propagationLossModel->
SetAttribute
(
"ShadowSigmaExtWalls"
,
DoubleValue
(0.0));
86
87
// propagationLossModel->SetAttribute ("Los2NlosThr", DoubleValue (1550.0));
88
89
//for (uint8_t i = 0; i < 23; i++)
90
for
(uint32_t i = 1; i < 2300; i++)
91
{
92
Ptr<ConstantPositionMobilityModel>
mmUe = CreateObject<ConstantPositionMobilityModel> ();
93
mmUe->
SetPosition
(
Vector
(i, 0.0, hUe));
94
Ptr<MobilityBuildingInfo>
buildingInfoUe = CreateObject<MobilityBuildingInfo> ();
95
mmUe->
AggregateObject
(buildingInfoUe);
// operation usually done by BuildingsHelper::Install
96
BuildingsHelper::MakeConsistent
(mmUe);
97
double
loss = propagationLossModel->
GetLoss
(mmEnb, mmUe);
98
outFile << i <<
"\t"
99
<< loss
100
<< std::endl;
101
}
102
103
Simulator::Destroy
();
104
105
}
ns3::ConfigStore
Definition:
config-store.h:34
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
ns3::HybridBuildingsPropagationLossModel::GetLoss
virtual double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Definition:
hybrid-buildings-propagation-loss-model.cc:142
ns3::Building::ConcreteWithWindows
Definition:
building.h:52
ns3::Vector3D
a 3d vector
Definition:
vector.h:31
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition:
fatal-error.h:72
ns3::BuildingsHelper::MakeConsistent
static void MakeConsistent(Ptr< MobilityModel > bmm)
Definition:
buildings-helper.cc:80
ns3::Object::AggregateObject
void AggregateObject(Ptr< Object > other)
Definition:
object.cc:242
ns3::CommandLine
Parse command-line arguments.
Definition:
command-line.h:152
ns3::Simulator::Destroy
static void Destroy(void)
Definition:
simulator.cc:121
ns3::ConfigStore::ConfigureDefaults
void ConfigureDefaults(void)
Definition:
config-store.cc:142
ns3::Building::SetExtWallsType
void SetExtWallsType(Building::ExtWallsType_t t)
Definition:
building.cc:153
ns3::Building::Residential
Definition:
building.h:48
ns3::MobilityModel::SetPosition
void SetPosition(const Vector &position)
Definition:
mobility-model.cc:73
main
int main(int argc, char *argv[])
Definition:
energy-model-example.cc:113
ns3::CommandLine::AddValue
void AddValue(const std::string &name, const std::string &help, T &value)
Definition:
command-line.h:408
ns3::CommandLine::Parse
void Parse(int argc, char *argv[])
Definition:
command-line.cc:104
ns3::DoubleValue
Hold an floating point type.
Definition:
double.h:41
ns3::ObjectBase::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Definition:
object-base.cc:160
ns3::Building::SetBuildingType
void SetBuildingType(Building::BuildingType_t t)
Definition:
building.cc:146
src
buildings
examples
buildings-pathloss-profiler.cc
Generated on Sat Nov 16 2013 16:17:36 for ns-3 by
1.8.5