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>
54 :
TestSuite (
"buildings-shadowing-test", SYSTEM)
78 :
TestCase (
"SHADOWING calculation: " + name),
79 m_mobilityModelIndex1 (m1),
80 m_mobilityModelIndex2 (m2),
105 std::vector<double> loss;
107 double sumSquared = 0.0;
109 for (
int i = 0; i < samples; i++)
116 "Shadowing is not constant for the same mobility model pair!");
117 loss.push_back (shadowingLoss);
118 sum += shadowingLoss;
119 sumSquared += (shadowingLoss * shadowingLoss);
121 double sampleMean = sum / samples;
122 double sampleVariance = (sumSquared - (sum * sum / samples)) / (samples - 1);
123 double sampleStd = std::sqrt (sampleVariance);
126 const double zn995 = 2.575829303549;
127 double ci = (zn995 * sampleStd) / std::sqrt (samples);
128 NS_LOG_INFO (
"SampleMean from simulation " << sampleMean <<
", sampleStd " << sampleStd <<
", reference value " <<
m_sigmaRef <<
", CI(99%) " << ci);
135 const double zchi2_005 = 887.621135217515;
136 const double zchi2_995 = 1117.89045267865;
140 Simulator::Destroy ();
161 double henbHeight = 10.0;
168 mm = CreateObject<ConstantPositionMobilityModel> ();
173 mm = CreateObject<ConstantPositionMobilityModel> ();
178 mm = CreateObject<ConstantPositionMobilityModel> ();
183 mm = CreateObject<ConstantPositionMobilityModel> ();
188 mm = CreateObject<ConstantPositionMobilityModel> ();
193 mm = CreateObject<ConstantPositionMobilityModel> ();
198 mm = CreateObject<ConstantPositionMobilityModel> ();
203 mm = CreateObject<ConstantPositionMobilityModel> ();
208 mm = CreateObject<ConstantPositionMobilityModel> ();
213 mm = CreateObject<ConstantPositionMobilityModel> ();
218 mm = CreateObject<ConstantPositionMobilityModel> ();
228 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
#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.
Test shadowing calculation.
void SetNFloors(uint16_t nfloors)
void AggregateObject(Ptr< Object > other)
#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)
uint16_t m_mobilityModelIndex1
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
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 LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
void SetBuildingType(Building::BuildingType_t t)