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
itu-r-1411-nlos-over-rooftop-test-suite.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2011,2012 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
* Nicola Baldo <nbaldo@cttc.es>
8
*/
9
10
#include <ns3/constant-position-mobility-model.h>
11
#include <ns3/double.h>
12
#include <ns3/enum.h>
13
#include <ns3/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h>
14
#include <ns3/log.h>
15
#include <ns3/string.h>
16
#include <ns3/test.h>
17
18
using namespace
ns3
;
19
20
NS_LOG_COMPONENT_DEFINE
(
"ItuR1411NlosOverRooftopPropagationLossModelTest"
);
21
22
/**
23
* \ingroup propagation-tests
24
*
25
* \brief ItuR1411NlosOverRooftopPropagationLossModel Test Case
26
*
27
*/
28
class
ItuR1411NlosOverRooftopPropagationLossModelTestCase
:
public
TestCase
29
{
30
public
:
31
/**
32
* Constructor
33
*
34
* \param freq carrier frequency in Hz
35
* \param dist 2D distance between UT and BS in meters
36
* \param hb height of BS in meters
37
* \param hm height of UT in meters
38
* \param env environment type
39
* \param city city type
40
* \param refValue reference loss value
41
* \param name TestCase name
42
*/
43
ItuR1411NlosOverRooftopPropagationLossModelTestCase
(
double
freq,
44
double
dist,
45
double
hb,
46
double
hm,
47
EnvironmentType
env,
48
CitySize
city,
49
double
refValue,
50
std::string name);
51
~ItuR1411NlosOverRooftopPropagationLossModelTestCase
()
override
;
52
53
private
:
54
void
DoRun
()
override
;
55
56
/**
57
* Create a MobilityModel
58
* \param index mobility model index
59
* \return a new MobilityModel
60
*/
61
Ptr<MobilityModel>
CreateMobilityModel
(uint16_t index);
62
63
double
m_freq
;
//!< carrier frequency in Hz
64
double
m_dist
;
//!< 2D distance between UT and BS in meters
65
double
m_hb
;
//!< height of BS in meters
66
double
m_hm
;
//!< height of UT in meters
67
EnvironmentType
m_env
;
//!< environment type
68
CitySize
m_city
;
//!< city type
69
double
m_lossRef
;
//!< reference loss
70
};
71
72
ItuR1411NlosOverRooftopPropagationLossModelTestCase::
73
ItuR1411NlosOverRooftopPropagationLossModelTestCase
(
double
freq,
74
double
dist,
75
double
hb,
76
double
hm,
77
EnvironmentType
env,
78
CitySize
city,
79
double
refValue,
80
std::string name)
81
:
TestCase
(name),
82
m_freq(freq),
83
m_dist(dist),
84
m_hb(hb),
85
m_hm(hm),
86
m_env(env),
87
m_city(city),
88
m_lossRef(refValue)
89
{
90
}
91
92
ItuR1411NlosOverRooftopPropagationLossModelTestCase::
93
~ItuR1411NlosOverRooftopPropagationLossModelTestCase
()
94
{
95
}
96
97
void
98
ItuR1411NlosOverRooftopPropagationLossModelTestCase::DoRun
()
99
{
100
NS_LOG_FUNCTION
(
this
);
101
102
Ptr<MobilityModel>
mma =
CreateObject<ConstantPositionMobilityModel>
();
103
mma->SetPosition(Vector(0.0, 0.0,
m_hb
));
104
105
Ptr<MobilityModel>
mmb =
CreateObject<ConstantPositionMobilityModel>
();
106
mmb->SetPosition(Vector(
m_dist
, 0.0,
m_hm
));
107
108
Ptr<ItuR1411NlosOverRooftopPropagationLossModel>
propagationLossModel =
109
CreateObject<ItuR1411NlosOverRooftopPropagationLossModel>
();
110
propagationLossModel->SetAttribute(
"Frequency"
,
DoubleValue
(
m_freq
));
111
propagationLossModel->SetAttribute(
"Environment"
,
EnumValue
(
m_env
));
112
propagationLossModel->SetAttribute(
"CitySize"
,
EnumValue
(
m_city
));
113
114
double
loss = propagationLossModel->GetLoss(mma, mmb);
115
116
NS_LOG_INFO
(
"Calculated loss: "
<< loss);
117
NS_LOG_INFO
(
"Theoretical loss: "
<<
m_lossRef
);
118
119
NS_TEST_ASSERT_MSG_EQ_TOL
(loss,
m_lossRef
, 0.1,
"Wrong loss!"
);
120
}
121
122
/**
123
* \ingroup propagation-tests
124
*
125
* \brief ItuR1411NlosOverRooftopPropagationLossModel TestSuite
126
*
127
*/
128
class
ItuR1411NlosOverRooftopPropagationLossModelTestSuite
:
public
TestSuite
129
{
130
public
:
131
ItuR1411NlosOverRooftopPropagationLossModelTestSuite
();
132
};
133
134
ItuR1411NlosOverRooftopPropagationLossModelTestSuite::
135
ItuR1411NlosOverRooftopPropagationLossModelTestSuite
()
136
:
TestSuite
(
"itu-r-1411-nlos-over-rooftop"
,
Type
::SYSTEM)
137
{
138
LogComponentEnable
(
"ItuR1411NlosOverRooftopPropagationLossModelTest"
,
LOG_LEVEL_ALL
);
139
140
// reference values obtained with the octave scripts in src/propagation/test/reference/
141
AddTestCase
(
new
ItuR1411NlosOverRooftopPropagationLossModelTestCase
(
142
2.1140e9,
143
900,
144
30,
145
1,
146
UrbanEnvironment
,
147
LargeCity
,
148
143.68,
149
"f=2114Mhz, dist=900, urban large city"
),
150
TestCase::Duration::QUICK);
151
AddTestCase
(
new
ItuR1411NlosOverRooftopPropagationLossModelTestCase
(
152
1.865e9,
153
500,
154
30,
155
1,
156
UrbanEnvironment
,
157
LargeCity
,
158
132.84,
159
"f=2114Mhz, dist=900, urban large city"
),
160
TestCase::Duration::QUICK);
161
}
162
163
/// Static variable for test initialization
164
static
ItuR1411NlosOverRooftopPropagationLossModelTestSuite
g_ituR1411NlosOverRooftopTestSuite
;
ItuR1411NlosOverRooftopPropagationLossModelTestCase
ItuR1411NlosOverRooftopPropagationLossModel Test Case.
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:29
ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_hb
double m_hb
height of BS in meters
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:65
ItuR1411NlosOverRooftopPropagationLossModelTestCase::CreateMobilityModel
Ptr< MobilityModel > CreateMobilityModel(uint16_t index)
Create a MobilityModel.
ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_freq
double m_freq
carrier frequency in Hz
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:63
ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_dist
double m_dist
2D distance between UT and BS in meters
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:64
ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_lossRef
double m_lossRef
reference loss
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:69
ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_city
CitySize m_city
city type
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:68
ItuR1411NlosOverRooftopPropagationLossModelTestCase::ItuR1411NlosOverRooftopPropagationLossModelTestCase
ItuR1411NlosOverRooftopPropagationLossModelTestCase(double freq, double dist, double hb, double hm, EnvironmentType env, CitySize city, double refValue, std::string name)
Constructor.
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:73
ItuR1411NlosOverRooftopPropagationLossModelTestCase::~ItuR1411NlosOverRooftopPropagationLossModelTestCase
~ItuR1411NlosOverRooftopPropagationLossModelTestCase() override
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:93
ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_hm
double m_hm
height of UT in meters
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:66
ItuR1411NlosOverRooftopPropagationLossModelTestCase::DoRun
void DoRun() override
Implementation to actually run this TestCase.
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:98
ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_env
EnvironmentType m_env
environment type
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:67
ItuR1411NlosOverRooftopPropagationLossModelTestSuite
ItuR1411NlosOverRooftopPropagationLossModel TestSuite.
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:129
ItuR1411NlosOverRooftopPropagationLossModelTestSuite::ItuR1411NlosOverRooftopPropagationLossModelTestSuite
ItuR1411NlosOverRooftopPropagationLossModelTestSuite()
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:135
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition
double.h:31
ns3::EnumValue
Hold variables of type enum.
Definition
enum.h:52
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TestCase
encapsulates test code
Definition
test.h:1050
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition
test.cc:292
ns3::TestSuite
A suite of tests to run.
Definition
test.h:1267
ns3::TestSuite::Type
Type
Type of test.
Definition
test.h:1274
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
ns3::EnvironmentType
EnvironmentType
The type of propagation environment.
Definition
propagation-environment.h:24
ns3::CitySize
CitySize
The size of the city in which propagation takes place.
Definition
propagation-environment.h:37
ns3::UrbanEnvironment
@ UrbanEnvironment
Definition
propagation-environment.h:25
ns3::LargeCity
@ LargeCity
Definition
propagation-environment.h:40
NS_TEST_ASSERT_MSG_EQ_TOL
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition
test.h:327
g_ituR1411NlosOverRooftopTestSuite
static ItuR1411NlosOverRooftopPropagationLossModelTestSuite g_ituR1411NlosOverRooftopTestSuite
Static variable for test initialization.
Definition
itu-r-1411-nlos-over-rooftop-test-suite.cc:164
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::LogComponentEnable
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
Definition
log.cc:291
ns3::LOG_LEVEL_ALL
@ LOG_LEVEL_ALL
Print everything.
Definition
log.h:105
src
propagation
test
itu-r-1411-nlos-over-rooftop-test-suite.cc
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0