A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
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
* 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/mobility-module.h"
12
#include "ns3/network-module.h"
13
#include <ns3/buildings-helper.h>
14
#include <ns3/constant-position-mobility-model.h>
15
#include <ns3/hybrid-buildings-propagation-loss-model.h>
16
17
#include <iomanip>
18
#include <string>
19
#include <vector>
20
21
using namespace
ns3
;
22
using
std::vector;
23
24
int
25
main(
int
argc,
char
* argv[])
26
{
27
double
hEnb = 30.0;
28
double
hUe = 1.0;
29
bool
enbIndoor =
false
;
30
bool
ueIndoor =
false
;
31
CommandLine
cmd
(__FILE__);
32
33
cmd
.AddValue(
"hEnb"
,
"Height of the eNB"
, hEnb);
34
cmd
.AddValue(
"hUe"
,
"Height of UE"
, hUe);
35
cmd
.AddValue(
"enbIndoor"
,
"Boolean for eNB Indoor/Outdoor selection"
, enbIndoor);
36
cmd
.AddValue(
"ueIndoor"
,
"Boolean for UE Indoor/Outdoor selection"
, ueIndoor);
37
cmd
.Parse(argc, argv);
38
39
ConfigStore
inputConfig;
40
inputConfig.
ConfigureDefaults
();
41
42
// parse again so you can override default values from the command line
43
cmd
.Parse(argc, argv);
44
45
std::ofstream outFile;
46
outFile.open(
"buildings-pathloss-profiler.out"
);
47
if
(!outFile.is_open())
48
{
49
NS_FATAL_ERROR
(
"Can't open output file"
);
50
}
51
52
Ptr<ConstantPositionMobilityModel>
mmEnb =
CreateObject<ConstantPositionMobilityModel>
();
53
mmEnb->SetPosition(Vector(0.0, 0.0, hEnb));
54
if
(enbIndoor)
55
{
56
Ptr<Building>
building1 =
CreateObject<Building>
(-2, 2, -2, 2, 0.0, 20.0);
57
building1->SetBuildingType(
Building::Residential
);
58
building1->SetExtWallsType(
Building::ConcreteWithWindows
);
59
}
60
61
Ptr<MobilityBuildingInfo>
buildingInfoEnb =
CreateObject<MobilityBuildingInfo>
();
62
mmEnb->AggregateObject(buildingInfoEnb);
// operation usually done by BuildingsHelper::Install
63
buildingInfoEnb->MakeConsistent(mmEnb);
64
65
Ptr<HybridBuildingsPropagationLossModel>
propagationLossModel =
66
CreateObject<HybridBuildingsPropagationLossModel>
();
67
// cancel shadowing effect
68
propagationLossModel->SetAttribute(
"ShadowSigmaOutdoor"
,
DoubleValue
(0.0));
69
propagationLossModel->SetAttribute(
"ShadowSigmaIndoor"
,
DoubleValue
(0.0));
70
propagationLossModel->SetAttribute(
"ShadowSigmaExtWalls"
,
DoubleValue
(0.0));
71
72
// propagationLossModel->SetAttribute ("Los2NlosThr", DoubleValue (1550.0));
73
74
// for (uint8_t i = 0; i < 23; i++)
75
for
(
uint32_t
i = 1; i < 2300; i++)
76
{
77
Ptr<ConstantPositionMobilityModel>
mmUe =
CreateObject<ConstantPositionMobilityModel>
();
78
mmUe->SetPosition(Vector(i, 0.0, hUe));
79
Ptr<MobilityBuildingInfo>
buildingInfoUe =
CreateObject<MobilityBuildingInfo>
();
80
mmUe->AggregateObject(buildingInfoUe);
// operation usually done by BuildingsHelper::Install
81
buildingInfoUe->MakeConsistent(mmUe);
82
double
loss = propagationLossModel->GetLoss(mmEnb, mmUe);
83
outFile << i <<
"\t"
<< loss << std::endl;
84
}
85
86
Simulator::Destroy
();
87
88
return
0;
89
}
ns3::Building::ConcreteWithWindows
@ ConcreteWithWindows
Definition
building.h:58
ns3::Building::Residential
@ Residential
Definition
building.h:47
ns3::CommandLine
Parse command-line arguments.
Definition
command-line.h:221
ns3::ConfigStore
Definition
config-store.h:50
ns3::ConfigStore::ConfigureDefaults
void ConfigureDefaults()
Configure the default values.
Definition
config-store.cc:183
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition
double.h:31
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::Simulator::Destroy
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition
simulator.cc:131
uint32_t
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition
fatal-error.h:168
ns3::CreateObject
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition
object.h:619
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
second.cmd
cmd
Definition
second.py:29
src
buildings
examples
buildings-pathloss-profiler.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0