27 TypeId(
"ns3::CorrelatedShwodingPropagationLossModel")
32 "CorrelationDistance",
33 "The distance at which the computed shadowing becomes"
56 Vector position = a->GetPosition();
58 double x = position.x;
59 double y = position.y;
69 std::pair<int, int> coordinates(xcoord, ycoord);
72 NS_LOG_DEBUG(
"xcoord " << xcoord <<
", ycoord " << ycoord);
82 NS_LOG_DEBUG(
"Creating a new shadowing map to be used at coordinates "
83 << coordinates.first <<
" " << coordinates.second);
92 NS_LOG_DEBUG(
"This square already has its shadowingMap!");
104 double loss = it->second->GetLoss(bPosition);
108 return txPowerDbm - loss;
123 {1.27968707244633, -0.366414485833771, -0.0415206295795327, -0.366414485833771},
124 {-0.366414485833771, 1.27968707244633, -0.366414485833771, -0.0415206295795327},
125 {-0.0415206295795327, -0.366414485833771, 1.27968707244633, -0.366414485833771},
126 {-0.366414485833771, -0.0415206295795327, -0.366414485833771, 1.27968707244633}};
129 : m_correlationDistance(110)
154 std::map<CorrelatedShadowingPropagationLossModel::Position, double>::const_iterator it;
155 it = m_shadowingMap.find(position);
159 if (it == m_shadowingMap.end())
162 double x = position.
x;
163 double y = position.
y;
164 int xcoord = ((x > 0) - (x < 0)) *
166 int ycoord = ((y > 0) - (y < 0)) *
181 NS_LOG_DEBUG(
"Generating a new shadowing value in the following quadrant:");
182 NS_LOG_DEBUG(
"xmin " << xmin <<
", xmax " << xmax <<
", ymin " << ymin <<
", ymax "
191 double q11 = m_shadowingValue->GetValue();
193 m_shadowingMap[lowerLeft] = q11;
194 double q12 = m_shadowingValue->GetValue();
196 m_shadowingMap[upperLeft] = q12;
197 double q21 = m_shadowingValue->GetValue();
199 m_shadowingMap[lowerRight] = q21;
200 double q22 = m_shadowingValue->GetValue();
202 m_shadowingMap[upperRight] = q22;
204 NS_LOG_DEBUG(q11 <<
" " << q12 <<
" " << q21 <<
" " << q22 <<
" ");
207 double c[2][4] = {{xmin, xmax, xmax, xmin}, {ymin, ymin, ymax, ymax}};
220 for (
int j = 0; j < 4; j++)
222 double distance = sqrt((c[0][j] - x) * (c[0][j] - x) + (c[1][j] - y) * (c[1][j] - y));
227 phi1 = phi1 + m_kInv[0][j] * k;
228 phi2 = phi2 + m_kInv[1][j] * k;
229 phi3 = phi3 + m_kInv[2][j] * k;
230 phi4 = phi4 + m_kInv[3][j] * k;
233 NS_LOG_DEBUG(
"Phi: " << phi1 <<
" " << phi2 <<
" " << phi3 <<
" " << phi4 <<
" ");
235 double shadowing = q11 * phi1 + q21 * phi2 + q22 * phi3 + q12 * phi4;
238 m_shadowingMap[position] = shadowing;
239 NS_LOG_DEBUG(
"Created new shadowing map: " << shadowing);
243 NS_LOG_DEBUG(
"Shadowing map for this location already exists");
246 return m_shadowingMap[position];
271 double EPSILON = 0.1;
272 return ((fabs(this->x - other.
x) < EPSILON) && (fabs(this->y - other.
y) < EPSILON));
283 if (this->x != other.
x)
285 return this->x < other.
x;
287 return this->y < other.
y;
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Models the propagation loss through a transmission medium.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#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_NOARGS()
Output the name of the function.
#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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeDoubleChecker()
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)