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),
103 std::vector<double> loss;
105 double sumSquared = 0.0;
107 for (
int i = 0; i < samples; i++)
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 BuildingsHelper::MakeConsistent (mm);
static BuildingsShadowingTestSuite buildingsShadowingTestSuite
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual double DoCalcRxPower(double txPowerDbm, Ptr< MobilityModel > a, Ptr< MobilityModel > b) const
Returns the Rx Power taking into account only the particular PropagatinLossModel. ...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
BuildingsShadowingTestCase(uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name)
TestCase.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Test shadowing calculation.
void SetNFloors(uint16_t nfloors)
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
#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...
BuildingsShadowingTestSuite()
Test 1.1 Shadowing compound test.
void SetExtWallsType(Building::ExtWallsType_t t)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t m_mobilityModelIndex1
void SetPosition(const Vector &position)
Ptr< MobilityModel > CreateMobilityModel(uint16_t index)
virtual ~BuildingsShadowingTestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
#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.
void SetBoundaries(Box box)
Set the boundaries of the building.
uint16_t m_mobilityModelIndex2
#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.
void SetBuildingType(Building::BuildingType_t t)