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
oh-buildings-propagation-loss-model.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
10
#include "
oh-buildings-propagation-loss-model.h
"
11
12
#include "
mobility-building-info.h
"
13
14
#include "ns3/double.h"
15
#include "ns3/enum.h"
16
#include "ns3/log.h"
17
#include "ns3/mobility-model.h"
18
#include "ns3/okumura-hata-propagation-loss-model.h"
19
#include "ns3/pointer.h"
20
#include "ns3/propagation-loss-model.h"
21
22
#include <cmath>
23
24
namespace
ns3
25
{
26
27
NS_LOG_COMPONENT_DEFINE
(
"OhBuildingsPropagationLossModel"
);
28
29
NS_OBJECT_ENSURE_REGISTERED
(OhBuildingsPropagationLossModel);
30
31
OhBuildingsPropagationLossModel::OhBuildingsPropagationLossModel
()
32
{
33
m_okumuraHata
=
CreateObject<OkumuraHataPropagationLossModel>
();
34
}
35
36
OhBuildingsPropagationLossModel::~OhBuildingsPropagationLossModel
()
37
{
38
}
39
40
TypeId
41
OhBuildingsPropagationLossModel::GetTypeId
()
42
{
43
static
TypeId
tid =
TypeId
(
"ns3::OhBuildingsPropagationLossModel"
)
44
45
.
SetParent
<
BuildingsPropagationLossModel
>()
46
.SetGroupName(
"Buildings"
)
47
48
.AddConstructor<
OhBuildingsPropagationLossModel
>();
49
50
return
tid;
51
}
52
53
double
54
OhBuildingsPropagationLossModel::GetLoss
(
Ptr<MobilityModel>
a,
Ptr<MobilityModel>
b)
const
55
{
56
NS_LOG_FUNCTION
(
this
<< a << b);
57
58
// get the MobilityBuildingInfo pointers
59
Ptr<MobilityBuildingInfo>
a1 = a->GetObject<
MobilityBuildingInfo
>();
60
Ptr<MobilityBuildingInfo>
b1 = b->GetObject<
MobilityBuildingInfo
>();
61
NS_ASSERT_MSG
(a1 && b1,
"OhBuildingsPropagationLossModel only works with MobilityBuildingInfo"
);
62
63
double
loss = 0.0;
64
65
bool
isAIndoor = a1->IsIndoor();
66
bool
isBIndoor = b1->IsIndoor();
67
68
if
(!isAIndoor)
// a is outdoor
69
{
70
if
(!isBIndoor)
// b is outdoor
71
{
72
loss =
m_okumuraHata
->GetLoss(a, b);
73
NS_LOG_INFO
(
this
<<
" O-O : "
<< loss);
74
}
75
else
76
{
77
// b indoor
78
loss =
m_okumuraHata
->GetLoss(a, b) +
ExternalWallLoss
(b1);
79
NS_LOG_INFO
(
this
<<
" O-I : "
<< loss);
80
}
// end b1->isIndoor ()
81
}
82
else
83
{
84
// a is indoor
85
if
(isBIndoor)
// b is indoor
86
{
87
if
(a1->GetBuilding() == b1->GetBuilding())
88
{
89
// nodes are in same building -> indoor communication ITU-R P.1238
90
loss =
m_okumuraHata
->GetLoss(a, b) +
InternalWallsLoss
(a1, b1);
91
NS_LOG_INFO
(
this
<<
" I-I (same building)"
<< loss);
92
}
93
else
94
{
95
// nodes are in different buildings
96
loss =
m_okumuraHata
->GetLoss(a, b) +
ExternalWallLoss
(a1) +
ExternalWallLoss
(b1);
97
NS_LOG_INFO
(
this
<<
" I-O-I (different buildings): "
<< loss);
98
}
99
}
100
else
101
{
102
loss =
m_okumuraHata
->GetLoss(a, b) +
ExternalWallLoss
(a1);
103
NS_LOG_INFO
(
this
<<
" I-O : "
<< loss);
104
}
// end if (isBIndoor)
105
}
// end if (!isAIndoor)
106
107
loss = std::max(0.0, loss);
108
return
loss;
109
}
110
111
}
// namespace ns3
ns3::BuildingsPropagationLossModel
This model provides means for simulating the following propagation phenomena in the presence of build...
Definition
buildings-propagation-loss-model.h:47
ns3::BuildingsPropagationLossModel::ExternalWallLoss
double ExternalWallLoss(Ptr< MobilityBuildingInfo > a) const
Calculate the external wall loss.
Definition
buildings-propagation-loss-model.cc:102
ns3::BuildingsPropagationLossModel::InternalWallsLoss
double InternalWallsLoss(Ptr< MobilityBuildingInfo > a, Ptr< MobilityBuildingInfo > b) const
Calculate the internal wall loss.
Definition
buildings-propagation-loss-model.cc:136
ns3::MobilityBuildingInfo
mobility buildings information (to be used by mobility models)
Definition
mobility-building-info.h:37
ns3::OhBuildingsPropagationLossModel
this model combines the OkumuraHata model with the BuildingsPropagationLossModel
Definition
oh-buildings-propagation-loss-model.h:30
ns3::OhBuildingsPropagationLossModel::m_okumuraHata
Ptr< OkumuraHataPropagationLossModel > m_okumuraHata
OkumuraHata Propagation Loss Model.
Definition
oh-buildings-propagation-loss-model.h:48
ns3::OhBuildingsPropagationLossModel::~OhBuildingsPropagationLossModel
~OhBuildingsPropagationLossModel() override
Definition
oh-buildings-propagation-loss-model.cc:36
ns3::OhBuildingsPropagationLossModel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
oh-buildings-propagation-loss-model.cc:41
ns3::OhBuildingsPropagationLossModel::GetLoss
double GetLoss(Ptr< MobilityModel > a, Ptr< MobilityModel > b) const override
Definition
oh-buildings-propagation-loss-model.cc:54
ns3::OhBuildingsPropagationLossModel::OhBuildingsPropagationLossModel
OhBuildingsPropagationLossModel()
Definition
oh-buildings-propagation-loss-model.cc:31
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition
assert.h:75
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition
log-macros-enabled.h:229
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition
log.h:264
ns3::CreateObject
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition
object.h:619
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
mobility-building-info.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
oh-buildings-propagation-loss-model.h
src
buildings
model
oh-buildings-propagation-loss-model.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0