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
kun-2600-mhz-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/kun-2600-mhz-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
(
"Kun2600MhzPropagationLossModelTest"
);
35
36
37
class
Kun2600MhzPropagationLossModelTestCase
:
public
TestCase
38
{
39
public
:
40
Kun2600MhzPropagationLossModelTestCase
(
double
dist,
double
hb,
double
hm,
double
refValue, std::string name);
41
virtual
~Kun2600MhzPropagationLossModelTestCase
();
42
43
private
:
44
virtual
void
DoRun
(
void
);
45
Ptr<MobilityModel>
CreateMobilityModel
(uint16_t index);
46
47
double
m_dist
;
48
double
m_hb
;
49
double
m_hm
;
50
double
m_lossRef
;
51
52
};
53
54
Kun2600MhzPropagationLossModelTestCase::Kun2600MhzPropagationLossModelTestCase
(
double
dist,
double
hb,
double
hm,
double
refValue, std::string name)
55
:
TestCase
(name),
56
m_dist (dist),
57
m_hb (hb),
58
m_hm (hm),
59
m_lossRef (refValue)
60
{
61
}
62
63
Kun2600MhzPropagationLossModelTestCase::~Kun2600MhzPropagationLossModelTestCase
()
64
{
65
}
66
67
68
69
void
70
Kun2600MhzPropagationLossModelTestCase::DoRun
(
void
)
71
{
72
NS_LOG_FUNCTION
(
this
);
73
74
75
Ptr<MobilityModel>
mma = CreateObject<ConstantPositionMobilityModel> ();
76
mma->
SetPosition
(
Vector
(0.0, 0.0,
m_hb
));
77
78
Ptr<MobilityModel>
mmb = CreateObject<ConstantPositionMobilityModel> ();
79
mmb->
SetPosition
(
Vector
(
m_dist
, 0.0,
m_hm
));
80
81
Ptr<Kun2600MhzPropagationLossModel>
propagationLossModel = CreateObject<Kun2600MhzPropagationLossModel> ();
82
83
double
loss = propagationLossModel->
GetLoss
(mma, mmb);
84
85
NS_LOG_INFO
(
"Calculated loss: "
<< loss);
86
NS_LOG_INFO
(
"Theoretical loss: "
<<
m_lossRef
);
87
88
NS_TEST_ASSERT_MSG_EQ_TOL
(loss,
m_lossRef
, 0.1,
"Wrong loss!"
);
89
90
}
91
92
93
94
class
Kun2600MhzPropagationLossModelTestSuite
:
public
TestSuite
95
{
96
public
:
97
Kun2600MhzPropagationLossModelTestSuite
();
98
};
99
100
101
102
Kun2600MhzPropagationLossModelTestSuite::Kun2600MhzPropagationLossModelTestSuite
()
103
:
TestSuite
(
"kun-2600-mhz"
, SYSTEM)
104
{
105
106
LogComponentEnable
(
"Kun2600MhzPropagationLossModelTest"
,
LOG_LEVEL_ALL
);
107
108
AddTestCase
(
new
Kun2600MhzPropagationLossModelTestCase
(2000, 30, 1, 121.83,
"dist=2000m"
));
109
110
111
}
112
113
114
115
static
Kun2600MhzPropagationLossModelTestSuite
g_kun2600MhzTestSuite
;
116
117
118
119
}
// namespace ns3
src
propagation
test
kun-2600-mhz-test-suite.cc
Generated on Tue Oct 9 2012 16:45:45 for ns-3 by
1.8.1.2