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>
50 :
TestSuite (
"buildings-shadowing-test", SYSTEM)
75 :
TestCase (
"SHADOWING calculation: " + name),
76 m_mobilityModelIndex1 (
m1),
77 m_mobilityModelIndex2 (
m2),
95 building1->SetBoundaries (
Box (-3000, -1, -4000, 4000.0, 0.0, 12));
96 building1->SetBuildingType (Building::Residential);
97 building1->SetExtWallsType (Building::ConcreteWithWindows);
98 building1->SetNFloors (3);
102 std::vector<double> loss;
104 double sumSquared = 0.0;
106 for (
int i = 0; i < samples; i++)
110 double shadowingLoss = propagationLossModel->DoCalcRxPower (0.0, mma, mmb) +
m_lossRef;
111 double shadowingLoss2 = propagationLossModel->DoCalcRxPower (0.0, mma, mmb) +
m_lossRef;
113 "Shadowing is not constant for the same mobility model pair!");
114 loss.push_back (shadowingLoss);
115 sum += shadowingLoss;
116 sumSquared += (shadowingLoss * shadowingLoss);
118 double sampleMean = sum / samples;
119 double sampleVariance = (sumSquared - (sum * sum / samples)) / (samples - 1);
120 double sampleStd = std::sqrt (sampleVariance);
123 const double zn995 = 2.575829303549;
124 double ci = (zn995 * sampleStd) / std::sqrt (samples);
125 NS_LOG_INFO (
"SampleMean from simulation " << sampleMean <<
", sampleStd " << sampleStd <<
", reference value " <<
m_sigmaRef <<
", CI(99%) " << ci);
132 const double zchi2_005 = 887.621135217515;
133 const double zchi2_995 = 1117.89045267865;
137 Simulator::Destroy ();
158 double henbHeight = 10.0;
165 mm = CreateObject<ConstantPositionMobilityModel> ();
170 mm = CreateObject<ConstantPositionMobilityModel> ();
175 mm = CreateObject<ConstantPositionMobilityModel> ();
180 mm = CreateObject<ConstantPositionMobilityModel> ();
185 mm = CreateObject<ConstantPositionMobilityModel> ();
190 mm = CreateObject<ConstantPositionMobilityModel> ();
195 mm = CreateObject<ConstantPositionMobilityModel> ();
200 mm = CreateObject<ConstantPositionMobilityModel> ();
205 mm = CreateObject<ConstantPositionMobilityModel> ();
210 mm = CreateObject<ConstantPositionMobilityModel> ();
215 mm = CreateObject<ConstantPositionMobilityModel> ();
225 buildingInfo->MakeConsistent (mm);
static BuildingsShadowingTestSuite buildingsShadowingTestSuite
Static variable for test initialization.
uint16_t m_mobilityModelIndex2
Second MobilityModel Index.
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)
virtual ~BuildingsShadowingTestCase()
BuildingsShadowingTestCase(uint16_t m1, uint16_t m2, double refValue, double sigmaRef, std::string name)
Constructor.
double m_sigmaRef
pathloss standard deviation value reference value
virtual void DoRun(void)
Implementation to actually run this TestCase.
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.
@ LOG_LEVEL_ALL
Print everything.
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.