author | Marco Miozzo <marco.miozzo@cttc.es> |
Mon, 03 Jun 2013 17:01:52 +0200 | |
changeset 10080 | 1b36e2276e15 |
parent 9266 | d26408b17360 |
child 10081 | f0879d02aafd |
permissions | -rw-r--r-- |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
2 |
/* |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
3 |
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
4 |
* |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
7 |
* published by the Free Software Foundation; |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
8 |
* |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
12 |
* GNU General Public License for more details. |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
13 |
* |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
17 |
* |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
18 |
* Author: Marco Miozzo <marco.miozzo@cttc.es> |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
19 |
* Nicola Baldo <nbaldo@cttc.es> |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
20 |
*/ |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
21 |
|
8822
49d3a0979d43
fixed Bug 1439 - exclude headers for tests from installation
Nicola Baldo <nbaldo@cttc.es>
parents:
8769
diff
changeset
|
22 |
#include <ns3/simulator.h> |
49d3a0979d43
fixed Bug 1439 - exclude headers for tests from installation
Nicola Baldo <nbaldo@cttc.es>
parents:
8769
diff
changeset
|
23 |
#include <ns3/log.h> |
8643
3c7d21485f21
Update BuildingPropagationLossModel for working in Hybrid and Simple modes
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8343
diff
changeset
|
24 |
#include <ns3/hybrid-buildings-propagation-loss-model.h> |
8822
49d3a0979d43
fixed Bug 1439 - exclude headers for tests from installation
Nicola Baldo <nbaldo@cttc.es>
parents:
8769
diff
changeset
|
25 |
#include <ns3/string.h> |
49d3a0979d43
fixed Bug 1439 - exclude headers for tests from installation
Nicola Baldo <nbaldo@cttc.es>
parents:
8769
diff
changeset
|
26 |
#include <ns3/double.h> |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
27 |
#include <ns3/building.h> |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
28 |
#include <ns3/enum.h> |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
29 |
#include <ns3/buildings-helper.h> |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
30 |
#include <ns3/mobility-model.h> |
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
31 |
#include <ns3/buildings-mobility-model.h> |
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
32 |
#include <ns3/constant-position-mobility-model.h> |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
33 |
|
8822
49d3a0979d43
fixed Bug 1439 - exclude headers for tests from installation
Nicola Baldo <nbaldo@cttc.es>
parents:
8769
diff
changeset
|
34 |
#include "buildings-shadowing-test.h" |
49d3a0979d43
fixed Bug 1439 - exclude headers for tests from installation
Nicola Baldo <nbaldo@cttc.es>
parents:
8769
diff
changeset
|
35 |
|
8248
986f7db9f056
Move Buildings related class to buildings folder
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8228
diff
changeset
|
36 |
NS_LOG_COMPONENT_DEFINE ("BuildingsShadowingTest"); |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
37 |
|
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
38 |
|
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
39 |
namespace ns3 { |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
40 |
|
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
41 |
|
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
42 |
|
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
43 |
/** |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
44 |
* Test 1.1 Shadowing compound test |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
45 |
*/ |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
46 |
|
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
47 |
/** |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
48 |
* This TestSuite tests the shadowing model of BuildingPathlossModel |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
49 |
* by reproducing several communication scenarios |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
50 |
*/ |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
51 |
|
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
52 |
|
8248
986f7db9f056
Move Buildings related class to buildings folder
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8228
diff
changeset
|
53 |
BuildingsShadowingTestSuite::BuildingsShadowingTestSuite () |
8332 | 54 |
: TestSuite ("buildings-shadowing-test", SYSTEM) |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
55 |
{ |
8332 | 56 |
|
8248
986f7db9f056
Move Buildings related class to buildings folder
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8228
diff
changeset
|
57 |
LogComponentEnable ("BuildingsShadowingTest", LOG_LEVEL_ALL); |
8332 | 58 |
|
59 |
// Test #1 Outdoor Model |
|
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
60 |
AddTestCase (new BuildingsShadowingTestCase (1, 2, 148.86, 7.0, "Outdoor Shadowing"), TestCase::QUICK); |
8332 | 61 |
|
8223
eedea1c39ddd
Shadowing test updated -> passed.
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8221
diff
changeset
|
62 |
// Test #2 Indoor model |
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
63 |
AddTestCase (new BuildingsShadowingTestCase (5, 6, 88.5724, 8.0, "Indoor Shadowing"), TestCase::QUICK); |
8332 | 64 |
|
8223
eedea1c39ddd
Shadowing test updated -> passed.
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8221
diff
changeset
|
65 |
// Test #3 Indoor -> Outdoor |
9266
d26408b17360
bug 1563: get rid of default argument value in AddTestCase
Nicola Baldo <nbaldo@cttc.es>
parents:
9063
diff
changeset
|
66 |
AddTestCase (new BuildingsShadowingTestCase (9, 10, 85.0012, 8.6, "Indoor -> Outdoor Shadowing"), TestCase::QUICK); |
8228
d8694ee58788
Test on shadowing finalized and passed
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8223
diff
changeset
|
67 |
|
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
68 |
} |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
69 |
|
8248
986f7db9f056
Move Buildings related class to buildings folder
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8228
diff
changeset
|
70 |
static BuildingsShadowingTestSuite buildingsShadowingTestSuite; |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
71 |
|
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
72 |
|
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
73 |
/** |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
74 |
* TestCase |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
75 |
*/ |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
76 |
|
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
77 |
BuildingsShadowingTestCase::BuildingsShadowingTestCase ( uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name) |
8332 | 78 |
: TestCase ("SHADOWING calculation: " + name), |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
79 |
m_mobilityModelIndex1 (m1), |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
80 |
m_mobilityModelIndex2 (m2), |
8332 | 81 |
m_lossRef (refValue), |
82 |
m_sigmaRef (sigmaRef) |
|
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
83 |
{ |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
84 |
} |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
85 |
|
8248
986f7db9f056
Move Buildings related class to buildings folder
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8228
diff
changeset
|
86 |
BuildingsShadowingTestCase::~BuildingsShadowingTestCase () |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
87 |
{ |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
88 |
} |
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
89 |
|
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
90 |
void |
8248
986f7db9f056
Move Buildings related class to buildings folder
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8228
diff
changeset
|
91 |
BuildingsShadowingTestCase::DoRun (void) |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
92 |
{ |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
93 |
NS_LOG_FUNCTION (this); |
8332 | 94 |
|
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
95 |
// the building basically occupies the negative x plane, so any node |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
96 |
// in this area will fall in the building |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
97 |
Ptr<Building> building1 = CreateObject<Building> (); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
98 |
building1->SetBoundaries (Box (-3000, -1, -4000, 4000.0, 0.0, 12)); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
99 |
building1->SetBuildingType (Building::Residential); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
100 |
building1->SetExtWallsType (Building::ConcreteWithWindows); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
101 |
building1->SetNFloors (3); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
102 |
|
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
103 |
Ptr<MobilityModel> mma = CreateMobilityModel (m_mobilityModelIndex1); |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
104 |
Ptr<MobilityModel> mmb = CreateMobilityModel (m_mobilityModelIndex2); |
8332 | 105 |
|
8223
eedea1c39ddd
Shadowing test updated -> passed.
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8221
diff
changeset
|
106 |
std::vector<double> loss; |
eedea1c39ddd
Shadowing test updated -> passed.
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8221
diff
changeset
|
107 |
double sum = 0.0; |
eedea1c39ddd
Shadowing test updated -> passed.
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8221
diff
changeset
|
108 |
double sumSquared = 0.0; |
eedea1c39ddd
Shadowing test updated -> passed.
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8221
diff
changeset
|
109 |
int samples = 10000; |
eedea1c39ddd
Shadowing test updated -> passed.
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8221
diff
changeset
|
110 |
for (int i = 0; i < samples; i++) |
8332 | 111 |
{ |
8643
3c7d21485f21
Update BuildingPropagationLossModel for working in Hybrid and Simple modes
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8343
diff
changeset
|
112 |
Ptr<HybridBuildingsPropagationLossModel> propagationLossModel = CreateObject<HybridBuildingsPropagationLossModel> (); |
3c7d21485f21
Update BuildingPropagationLossModel for working in Hybrid and Simple modes
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8343
diff
changeset
|
113 |
loss.push_back (propagationLossModel->DoCalcRxPower (0.0, mma, mmb) + m_lossRef); |
8332 | 114 |
sum += loss.at (loss.size () - 1); |
115 |
sumSquared += (loss.at (loss.size () - 1) * loss.at (loss.size () - 1)); |
|
116 |
} |
|
117 |
double mean = sum / samples; |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8822
diff
changeset
|
118 |
double sigma = std::sqrt (sumSquared / samples - (mean * mean)); |
8228
d8694ee58788
Test on shadowing finalized and passed
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8223
diff
changeset
|
119 |
// test whether the distribution falls in the 99% confidence interval, as expected with a nornal distribution |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8822
diff
changeset
|
120 |
double ci = (2.575829303549 * sigma) / std::sqrt (samples); |
8332 | 121 |
|
8228
d8694ee58788
Test on shadowing finalized and passed
Marco Miozzo <marco.miozzo@cttc.es>
parents:
8223
diff
changeset
|
122 |
NS_LOG_INFO ("Mean from simulation " << mean << ", sigma " << sigma << ", reference value " << m_sigmaRef << ", CI(99%) " << ci); |
8332 | 123 |
|
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
8822
diff
changeset
|
124 |
NS_TEST_ASSERT_MSG_EQ_TOL (std::fabs (mean), 0.0, ci, "Wrong shadowing distribution !"); |
8343
eedd3a7c4c1b
buildings-shadowing-test now passing valgrind test
Nicola Baldo <nbaldo@cttc.es>
parents:
8332
diff
changeset
|
125 |
Simulator::Destroy (); |
8221
2cf1345bb23f
add test on shadowing (draft version)
Marco Miozzo <marco.miozzo@cttc.es>
parents:
diff
changeset
|
126 |
} |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
127 |
|
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
128 |
|
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
129 |
|
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
130 |
Ptr<MobilityModel> |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
131 |
BuildingsShadowingTestCase::CreateMobilityModel (uint16_t index) |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
132 |
{ |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
133 |
|
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
134 |
/* |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
135 |
* The purpose of this method is to defer the creation of the |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
136 |
* MobilityModel instances to when DoRun() is called. In a previous |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
137 |
* version, MobilityModel instances where created directly in the |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
138 |
* constructor of the test suite, which caused subtle bugs due to |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
139 |
* "static initialization order fiasco". An example of such a subtle |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
140 |
* bug is that logging via NS_LOG failed for some modules. |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
141 |
* |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
142 |
*/ |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
143 |
|
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
144 |
double hm = 1; |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
145 |
double hb = 30; |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
146 |
double henbHeight = 10.0; |
8332 | 147 |
|
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
148 |
Ptr<MobilityModel> mm; |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
149 |
|
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
150 |
switch (index) |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
151 |
{ |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
152 |
case 1: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
153 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
154 |
mm->SetPosition (Vector (0.0, 0.0, hb)); |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
155 |
break; |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
156 |
|
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
157 |
case 2: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
158 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
159 |
mm->SetPosition (Vector (2000, 0.0, hm)); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
160 |
break; |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
161 |
|
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
162 |
case 3: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
163 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
164 |
mm->SetPosition (Vector (100, 0.0, hm)); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
165 |
break; |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
166 |
|
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
167 |
case 4: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
168 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
169 |
mm->SetPosition (Vector (900, 0.0, hm)); |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
170 |
break; |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
171 |
|
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
172 |
case 5: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
173 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
174 |
mm->SetPosition (Vector (-5, 0.0, hm)); |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
175 |
break; |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
176 |
|
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
177 |
case 6: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
178 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
179 |
mm->SetPosition (Vector (-5, 30, henbHeight)); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
180 |
break; |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
181 |
|
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
182 |
case 7: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
183 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
184 |
mm->SetPosition (Vector (-2000, 0.0, hm)); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
185 |
break; |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
186 |
|
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
187 |
case 8: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
188 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
189 |
mm->SetPosition (Vector (-100, 0.0, hm)); |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
190 |
break; |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
191 |
|
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
192 |
case 9: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
193 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
194 |
mm->SetPosition (Vector (0, 0.0, hm)); |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
195 |
break; |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
196 |
|
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
197 |
case 10: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
198 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
199 |
mm->SetPosition (Vector (-100, 0.0, henbHeight)); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
200 |
break; |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
201 |
|
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
202 |
case 11: |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
203 |
mm = CreateObject<ConstantPositionMobilityModel> (); |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
204 |
mm->SetPosition (Vector (-500, 0.0, henbHeight)); |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
205 |
break; |
8332 | 206 |
|
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
207 |
default: |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
208 |
mm = 0; |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
209 |
break; |
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
210 |
} |
10080
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
211 |
Ptr<MobilityBuildingInfo> buildingInfo = CreateObject<MobilityBuildingInfo> (); |
1b36e2276e15
Move from BuildingsMobilityModel to BuildingMobilityInfo source, tests and examples
Marco Miozzo <marco.miozzo@cttc.es>
parents:
9266
diff
changeset
|
212 |
mm->AggregateObject (buildingInfo); // operation usually done by BuildingsHelper::Install |
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
213 |
BuildingsHelper::MakeConsistent (mm); |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
214 |
return mm; |
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
215 |
} |
8318
368cccf883a6
fixes bug LENA-174: NS_LOG does not work for some log component with test-runner
Nicola Baldo <nbaldo@cttc.es>
parents:
8317
diff
changeset
|
216 |
|
8769
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
217 |
|
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
218 |
|
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
219 |
|
292e9e8345cf
remove BuildingsMobilityModel setters that don't allow consistency checking
Nicola Baldo <nbaldo@cttc.es>
parents:
8661
diff
changeset
|
220 |
} // namespace ns3 |