23 #include <ns3/building.h>
24 #include <ns3/buildings-helper.h>
25 #include <ns3/constant-position-mobility-model.h>
26 #include <ns3/double.h>
28 #include <ns3/hybrid-buildings-propagation-loss-model.h>
30 #include <ns3/mobility-building-info.h>
31 #include <ns3/mobility-model.h>
33 #include <ns3/simulator.h>
34 #include <ns3/string.h>
48 :
TestSuite(
"buildings-shadowing-test", SYSTEM)
77 :
TestCase(
"SHADOWING calculation: " + name),
78 m_mobilityModelIndex1(
m1),
79 m_mobilityModelIndex2(
m2),
97 building1->SetBoundaries(
Box(-3000, -1, -4000, 4000.0, 0.0, 12));
98 building1->SetBuildingType(Building::Residential);
99 building1->SetExtWallsType(Building::ConcreteWithWindows);
100 building1->SetNFloors(3);
103 CreateObject<HybridBuildingsPropagationLossModel>();
105 std::vector<double> loss;
107 double sumSquared = 0.0;
109 for (
int i = 0; i < samples; i++)
113 double shadowingLoss = propagationLossModel->DoCalcRxPower(0.0, mma, mmb) +
m_lossRef;
114 double shadowingLoss2 = propagationLossModel->DoCalcRxPower(0.0, mma, mmb) +
m_lossRef;
118 "Shadowing is not constant for the same mobility model pair!");
119 loss.push_back(shadowingLoss);
120 sum += shadowingLoss;
121 sumSquared += (shadowingLoss * shadowingLoss);
123 double sampleMean = sum / samples;
124 double sampleVariance = (sumSquared - (sum * sum / samples)) / (samples - 1);
125 double sampleStd = std::sqrt(sampleVariance);
128 const double zn995 = 2.575829303549;
129 double ci = (zn995 * sampleStd) / std::sqrt(samples);
130 NS_LOG_INFO(
"SampleMean from simulation " << sampleMean <<
", sampleStd " << sampleStd
131 <<
", reference value " <<
m_sigmaRef <<
", CI(99%) "
139 const double zchi2_005 = 887.621135217515;
140 const double zchi2_995 = 1117.89045267865;
144 Simulator::Destroy();
162 double henbHeight = 10.0;
169 mm = CreateObject<ConstantPositionMobilityModel>();
174 mm = CreateObject<ConstantPositionMobilityModel>();
179 mm = CreateObject<ConstantPositionMobilityModel>();
184 mm = CreateObject<ConstantPositionMobilityModel>();
189 mm = CreateObject<ConstantPositionMobilityModel>();
194 mm = CreateObject<ConstantPositionMobilityModel>();
199 mm = CreateObject<ConstantPositionMobilityModel>();
204 mm = CreateObject<ConstantPositionMobilityModel>();
209 mm = CreateObject<ConstantPositionMobilityModel>();
214 mm = CreateObject<ConstantPositionMobilityModel>();
219 mm = CreateObject<ConstantPositionMobilityModel>();
229 buildingInfo->MakeConsistent(mm);
static BuildingsShadowingTestSuite buildingsShadowingTestSuite
Static variable for test initialization.
uint16_t m_mobilityModelIndex2
Second MobilityModel Index.
~BuildingsShadowingTestCase() override
Ptr< MobilityModel > CreateMobilityModel(uint16_t index)
Create a mobility model based on its index.
uint16_t m_mobilityModelIndex1
First MobilityModel Index.
double m_lossRef
pathloss value (without shadowing)
void DoRun() override
Implementation to actually run this TestCase.
BuildingsShadowingTestCase(uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name)
Constructor.
double m_sigmaRef
pathloss standard deviation value reference value
BuildingsShadowingTestSuite()
void SetPosition(const Vector &position)
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Smart pointer class similar to boost::intrusive_ptr.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
#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...
const double m1
First component modulus, 232 - 209.
const double m2
Second component modulus, 232 - 22853.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
@ LOG_LEVEL_ALL
Print everything.