20#include "ns3/double.h"
38 TypeId(
"ns3::CorrelatedShwodingPropagationLossModel")
43 "CorrelationDistance",
44 "The distance at which the computed shadowing becomes"
48 MakeDoubleChecker<double>());
67 Vector position = a->GetPosition();
69 double x = position.x;
70 double y = position.y;
80 std::pair<int, int> coordinates(xcoord, ycoord);
83 NS_LOG_DEBUG(
"xcoord " << xcoord <<
", ycoord " << ycoord);
93 NS_LOG_DEBUG(
"Creating a new shadowing map to be used at coordinates "
94 << coordinates.first <<
" " << coordinates.second);
97 Create<CorrelatedShadowingPropagationLossModel::ShadowingMap>();
103 NS_LOG_DEBUG(
"This square already has its shadowingMap!");
115 double loss = it->second->GetLoss(bPosition);
119 return txPowerDbm - loss;
134 {1.27968707244633, -0.366414485833771, -0.0415206295795327, -0.366414485833771},
135 {-0.366414485833771, 1.27968707244633, -0.366414485833771, -0.0415206295795327},
136 {-0.0415206295795327, -0.366414485833771, 1.27968707244633, -0.366414485833771},
137 {-0.366414485833771, -0.0415206295795327, -0.366414485833771, 1.27968707244633}};
140 : m_correlationDistance(110)
165 std::map<CorrelatedShadowingPropagationLossModel::Position, double>::const_iterator it;
166 it = m_shadowingMap.find(position);
170 if (it == m_shadowingMap.end())
173 double x = position.
x;
174 double y = position.
y;
175 int xcoord = ((x > 0) - (x < 0)) *
177 int ycoord = ((y > 0) - (y < 0)) *
192 NS_LOG_DEBUG(
"Generating a new shadowing value in the following quadrant:");
193 NS_LOG_DEBUG(
"xmin " << xmin <<
", xmax " << xmax <<
", ymin " << ymin <<
", ymax "
202 double q11 = m_shadowingValue->GetValue();
204 m_shadowingMap[lowerLeft] = q11;
205 double q12 = m_shadowingValue->GetValue();
207 m_shadowingMap[upperLeft] = q12;
208 double q21 = m_shadowingValue->GetValue();
210 m_shadowingMap[lowerRight] = q21;
211 double q22 = m_shadowingValue->GetValue();
213 m_shadowingMap[upperRight] = q22;
215 NS_LOG_DEBUG(q11 <<
" " << q12 <<
" " << q21 <<
" " << q22 <<
" ");
218 double c[2][4] = {{xmin, xmax, xmax, xmin}, {ymin, ymin, ymax, ymax}};
231 for (
int j = 0; j < 4; j++)
233 double distance = sqrt((c[0][j] - x) * (c[0][j] - x) + (c[1][j] - y) * (c[1][j] - y));
238 phi1 = phi1 + m_kInv[0][j] * k;
239 phi2 = phi2 + m_kInv[1][j] * k;
240 phi3 = phi3 + m_kInv[2][j] * k;
241 phi4 = phi4 + m_kInv[3][j] * k;
244 NS_LOG_DEBUG(
"Phi: " << phi1 <<
" " << phi2 <<
" " << phi3 <<
" " << phi4 <<
" ");
246 double shadowing = q11 * phi1 + q21 * phi2 + q22 * phi3 + q12 * phi4;
249 m_shadowingMap[position] = shadowing;
250 NS_LOG_DEBUG(
"Created new shadowing map: " << shadowing);
254 NS_LOG_DEBUG(
"Shadowing map for this location already exists");
257 return m_shadowingMap[position];
282 double EPSILON = 0.1;
283 return ((fabs(this->x - other.
x) < EPSILON) && (fabs(this->y - other.
y) < EPSILON));
294 if (this->x != other.
x)
296 return this->x < other.
x;
298 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.
#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.
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)