22 #include <ns3/simulator.h>
24 #include <ns3/hybrid-buildings-propagation-loss-model.h>
25 #include <ns3/string.h>
26 #include <ns3/double.h>
27 #include <ns3/building.h>
29 #include <ns3/buildings-helper.h>
30 #include <ns3/mobility-model.h>
31 #include <ns3/mobility-building-info.h>
32 #include <ns3/constant-position-mobility-model.h>
52 :
TestSuite (
"buildings-shadowing-test", SYSTEM)
76 :
TestCase (
"SHADOWING calculation: " + name),
77 m_mobilityModelIndex1 (
m1),
78 m_mobilityModelIndex2 (
m2),
96 building1->SetBoundaries (
Box (-3000, -1, -4000, 4000.0, 0.0, 12));
97 building1->SetBuildingType (Building::Residential);
98 building1->SetExtWallsType (Building::ConcreteWithWindows);
99 building1->SetNFloors (3);
103 std::vector<double> loss;
105 double sumSquared = 0.0;
107 for (
int i = 0; i < samples; i++)
111 double shadowingLoss = propagationLossModel->DoCalcRxPower (0.0, mma, mmb) +
m_lossRef;
112 double shadowingLoss2 = propagationLossModel->DoCalcRxPower (0.0, mma, mmb) +
m_lossRef;
114 "Shadowing is not constant for the same mobility model pair!");
115 loss.push_back (shadowingLoss);
116 sum += shadowingLoss;
117 sumSquared += (shadowingLoss * shadowingLoss);
119 double sampleMean = sum / samples;
120 double sampleVariance = (sumSquared - (sum * sum / samples)) / (samples - 1);
121 double sampleStd = std::sqrt (sampleVariance);
124 const double zn995 = 2.575829303549;
125 double ci = (zn995 * sampleStd) / std::sqrt (samples);
126 NS_LOG_INFO (
"SampleMean from simulation " << sampleMean <<
", sampleStd " << sampleStd <<
", reference value " <<
m_sigmaRef <<
", CI(99%) " << ci);
133 const double zchi2_005 = 887.621135217515;
134 const double zchi2_995 = 1117.89045267865;
138 Simulator::Destroy ();
159 double henbHeight = 10.0;
166 mm = CreateObject<ConstantPositionMobilityModel> ();
171 mm = CreateObject<ConstantPositionMobilityModel> ();
176 mm = CreateObject<ConstantPositionMobilityModel> ();
181 mm = CreateObject<ConstantPositionMobilityModel> ();
186 mm = CreateObject<ConstantPositionMobilityModel> ();
191 mm = CreateObject<ConstantPositionMobilityModel> ();
196 mm = CreateObject<ConstantPositionMobilityModel> ();
201 mm = CreateObject<ConstantPositionMobilityModel> ();
206 mm = CreateObject<ConstantPositionMobilityModel> ();
211 mm = CreateObject<ConstantPositionMobilityModel> ();
216 mm = CreateObject<ConstantPositionMobilityModel> ();
226 buildingInfo->MakeConsistent (mm);
static BuildingsShadowingTestSuite buildingsShadowingTestSuite
uint16_t m_mobilityModelIndex2
Ptr< MobilityModel > CreateMobilityModel(uint16_t index)
uint16_t m_mobilityModelIndex1
virtual ~BuildingsShadowingTestCase()
BuildingsShadowingTestCase(uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name)
TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Test shadowing calculation.
BuildingsShadowingTestSuite()
Test 1.1 Shadowing compound test.
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.
@ LOG_LEVEL_ALL
Print everything.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.