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
itu-r-1411-nlos-over-rooftop-test-suite.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011,2012 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
* Nicola Baldo <nbaldo@cttc.es>
20
*/
21
22
23
#include <ns3/log.h>
24
#include <ns3/test.h>
25
#include <ns3/itu-r-1411-nlos-over-rooftop-propagation-loss-model.h>
26
#include <ns3/string.h>
27
#include <ns3/double.h>
28
#include <ns3/constant-position-mobility-model.h>
29
#include <ns3/enum.h>
30
31
32
namespace
ns3 {
33
34
NS_LOG_COMPONENT_DEFINE
(
"ItuR1411NlosOverRooftopPropagationLossModelTest"
)
35
;
36
37
38
class
ItuR1411NlosOverRooftopPropagationLossModelTestCase
:
public
TestCase
39
{
40
public
:
41
ItuR1411NlosOverRooftopPropagationLossModelTestCase
(
double
freq,
double
dist,
double
hb,
double
hm,
EnvironmentType
env,
CitySize
city,
double
refValue, std::string name);
42
virtual
~ItuR1411NlosOverRooftopPropagationLossModelTestCase
();
43
44
private
:
45
virtual
void
DoRun
(
void
);
46
Ptr<MobilityModel>
CreateMobilityModel
(uint16_t index);
47
48
double
m_freq
;
49
double
m_dist
;
50
double
m_hb
;
51
double
m_hm
;
52
EnvironmentType
m_env
;
53
CitySize
m_city
;
54
double
m_lossRef
;
55
56
};
57
58
ItuR1411NlosOverRooftopPropagationLossModelTestCase::ItuR1411NlosOverRooftopPropagationLossModelTestCase
(
double
freq,
double
dist,
double
hb,
double
hm,
EnvironmentType
env,
CitySize
city,
double
refValue, std::string name)
59
:
TestCase
(name),
60
m_freq (freq),
61
m_dist (dist),
62
m_hb (hb),
63
m_hm (hm),
64
m_env (env),
65
m_city (city),
66
m_lossRef (refValue)
67
{
68
}
69
70
ItuR1411NlosOverRooftopPropagationLossModelTestCase::~ItuR1411NlosOverRooftopPropagationLossModelTestCase
()
71
{
72
}
73
74
75
76
void
77
ItuR1411NlosOverRooftopPropagationLossModelTestCase::DoRun
(
void
)
78
{
79
NS_LOG_FUNCTION
(
this
);
80
81
82
Ptr<MobilityModel>
mma = CreateObject<ConstantPositionMobilityModel> ();
83
mma->
SetPosition
(
Vector
(0.0, 0.0,
m_hb
));
84
85
Ptr<MobilityModel>
mmb = CreateObject<ConstantPositionMobilityModel> ();
86
mmb->
SetPosition
(
Vector
(
m_dist
, 0.0,
m_hm
));
87
88
Ptr<ItuR1411NlosOverRooftopPropagationLossModel>
propagationLossModel = CreateObject<ItuR1411NlosOverRooftopPropagationLossModel> ();
89
propagationLossModel->SetAttribute (
"Frequency"
,
DoubleValue
(
m_freq
));
90
propagationLossModel->SetAttribute (
"Environment"
,
EnumValue
(
m_env
));
91
propagationLossModel->SetAttribute (
"CitySize"
,
EnumValue
(
m_city
));
92
93
double
loss = propagationLossModel->GetLoss (mma, mmb);
94
95
NS_LOG_INFO
(
"Calculated loss: "
<< loss);
96
NS_LOG_INFO
(
"Theoretical loss: "
<<
m_lossRef
);
97
98
NS_TEST_ASSERT_MSG_EQ_TOL
(loss,
m_lossRef
, 0.1,
"Wrong loss!"
);
99
100
}
101
102
103
104
class
ItuR1411NlosOverRooftopPropagationLossModelTestSuite
:
public
TestSuite
105
{
106
public
:
107
ItuR1411NlosOverRooftopPropagationLossModelTestSuite
();
108
};
109
110
111
112
ItuR1411NlosOverRooftopPropagationLossModelTestSuite::ItuR1411NlosOverRooftopPropagationLossModelTestSuite
()
113
:
TestSuite
(
"itu-r-1411-nlos-over-rooftop"
, SYSTEM)
114
{
115
116
LogComponentEnable
(
"ItuR1411NlosOverRooftopPropagationLossModelTest"
,
LOG_LEVEL_ALL
);
117
118
// reference values obtained with the octave scripts in src/propagation/test/reference/
119
120
AddTestCase
(
new
ItuR1411NlosOverRooftopPropagationLossModelTestCase
(2.1140e9, 900, 30, 1,
UrbanEnvironment
,
LargeCity
, 143.68,
"f=2114Mhz, dist=900, urban large city"
),
TestCase::QUICK
);
121
122
AddTestCase
(
new
ItuR1411NlosOverRooftopPropagationLossModelTestCase
(1.865e9, 500, 30, 1,
UrbanEnvironment
,
LargeCity
, 132.84,
"f=2114Mhz, dist=900, urban large city"
),
TestCase::QUICK
);
123
124
}
125
126
127
128
static
ItuR1411NlosOverRooftopPropagationLossModelTestSuite
g_ituR1411NlosOverRooftopTestSuite
;
129
130
131
132
}
// namespace ns3
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_freq
double m_freq
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:48
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:77
ns3::Ptr< MobilityModel >
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
ns3::EnvironmentType
EnvironmentType
The type of propagation environment.
Definition:
propagation-environment.h:36
ns3::NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("GrantedTimeWindowMpiInterface")
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:326
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::~ItuR1411NlosOverRooftopPropagationLossModelTestCase
virtual ~ItuR1411NlosOverRooftopPropagationLossModelTestCase()
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:70
ns3::TestSuite
A suite of tests to run.
Definition:
test.h:1025
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_hb
double m_hb
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:50
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::CreateMobilityModel
Ptr< MobilityModel > CreateMobilityModel(uint16_t index)
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Definition:
log.h:298
ns3::UrbanEnvironment
Definition:
propagation-environment.h:38
ns3::TestCase
encapsulates test code
Definition:
test.h:849
ns3::Vector3D
a 3d vector
Definition:
vector.h:31
ns3::EnumValue
hold variables of type 'enum'
Definition:
enum.h:37
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_lossRef
double m_lossRef
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:54
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestSuite::ItuR1411NlosOverRooftopPropagationLossModelTestSuite
ItuR1411NlosOverRooftopPropagationLossModelTestSuite()
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:112
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestSuite
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:104
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_dist
double m_dist
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:49
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_city
CitySize m_city
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:53
ns3::g_ituR1411NlosOverRooftopTestSuite
static ItuR1411NlosOverRooftopPropagationLossModelTestSuite g_ituR1411NlosOverRooftopTestSuite
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:128
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
Definition:
test.cc:173
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:38
ns3::MobilityModel::SetPosition
void SetPosition(const Vector &position)
Definition:
mobility-model.cc:74
ns3::TestCase::QUICK
Fast test.
Definition:
test.h:857
ns3::CitySize
CitySize
The size of the city in which propagation takes place.
Definition:
propagation-environment.h:48
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_hm
double m_hm
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:51
ns3::LargeCity
Definition:
propagation-environment.h:50
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::ItuR1411NlosOverRooftopPropagationLossModelTestCase
ItuR1411NlosOverRooftopPropagationLossModelTestCase(double freq, double dist, double hb, double hm, EnvironmentType env, CitySize city, double refValue, std::string name)
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:58
ns3::LOG_LEVEL_ALL
Definition:
log.h:90
ns3::DoubleValue
Hold a floating point type.
Definition:
double.h:41
ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::m_env
EnvironmentType m_env
Definition:
itu-r-1411-nlos-over-rooftop-test-suite.cc:52
ns3::LogComponentEnable
void LogComponentEnable(char const *name, enum LogLevel level)
Definition:
log.cc:311
src
propagation
test
itu-r-1411-nlos-over-rooftop-test-suite.cc
Generated on Sat Apr 19 2014 14:07:07 for ns-3 by
1.8.6