27 #include "ns3/mobility-model.h"
39 static TypeId tid =
TypeId(
"ns3::BuildingsChannelConditionModel")
41 .SetGroupName(
"Buildings")
62 NS_ASSERT_MSG(a1 && b1,
"BuildingsChannelConditionModel only works with MobilityBuildingInfo");
66 bool isAIndoor = a1->IsIndoor();
67 bool isBIndoor = b1->IsIndoor();
69 if (!isAIndoor && !isBIndoor)
71 cond->SetO2iCondition(ChannelCondition::O2iConditionValue::O2O);
77 NS_LOG_DEBUG(
"a and b are outdoor, blocked " << blocked);
81 cond->SetLosCondition(ChannelCondition::LosConditionValue::LOS);
85 cond->SetLosCondition(ChannelCondition::LosConditionValue::NLOS);
88 else if (isAIndoor && isBIndoor)
90 cond->SetO2iCondition(ChannelCondition::O2iConditionValue::I2I);
94 if (a1->GetBuilding() == b1->GetBuilding())
97 cond->SetLosCondition(ChannelCondition::LosConditionValue::LOS);
101 NS_LOG_DEBUG(
"a and b are indoor in different buildings");
102 cond->SetLosCondition(ChannelCondition::LosConditionValue::NLOS);
109 lowHighLossConditionA1 =
110 a1->GetBuilding()->GetExtWallsType() == Building::ExtWallsType_t::Wood ||
111 a1->GetBuilding()->GetExtWallsType() ==
112 Building::ExtWallsType_t::ConcreteWithWindows
116 lowHighLossConditionB1 =
117 b1->GetBuilding()->GetExtWallsType() == Building::ExtWallsType_t::Wood ||
118 b1->GetBuilding()->GetExtWallsType() ==
119 Building::ExtWallsType_t::ConcreteWithWindows
136 cond->SetO2iCondition(ChannelCondition::O2iConditionValue::O2I);
138 NS_LOG_DEBUG(
"a is indoor and b outdoor or vice-versa");
139 cond->SetLosCondition(ChannelCondition::LosConditionValue::NLOS);
146 lowHighLossCondition =
147 a1->GetBuilding()->GetExtWallsType() == Building::ExtWallsType_t::Wood ||
148 a1->GetBuilding()->GetExtWallsType() ==
149 Building::ExtWallsType_t::ConcreteWithWindows
153 cond->SetO2iLowHighCondition(lowHighLossCondition);
157 lowHighLossCondition =
158 b1->GetBuilding()->GetExtWallsType() == Building::ExtWallsType_t::Wood ||
159 b1->GetBuilding()->GetExtWallsType() ==
160 Building::ExtWallsType_t::ConcreteWithWindows
163 cond->SetO2iLowHighCondition(lowHighLossCondition);
172 const ns3::Vector& l2)
const
176 if ((*bit)->IsIntersect(l1, l2))
Determines the channel condition based on the buildings deployed in the scenario.
int64_t AssignStreams(int64_t stream) override
If this model uses objects of type RandomVariableStream, set the stream numbers to the integers start...
Ptr< ChannelCondition > GetChannelCondition(Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the condition of the channel between a and b.
bool IsLineOfSightBlocked(const Vector &l1, const Vector &l2) const
Checks if the line of sight between position l1 and position l2 is blocked by a building.
BuildingsChannelConditionModel()
Constructor for the BuildingsChannelConditionModel class.
static TypeId GetTypeId()
Get the type ID.
~BuildingsChannelConditionModel() override
Destructor for the BuildingsChannelConditionModel class.
O2iLowHighConditionValue
Possible values for Low-High Penetration Loss condition.
Models the channel condition.
mobility buildings information (to be used by mobility models)
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.