Mapping used to represent attenuation of a signal by JakesFading. More...
#include <JakesFading.h>
Inherits SimpleConstMapping.
Public Member Functions | |
JakesFadingMapping (JakesFading *model, double relSpeed, const Argument &start, const Argument &interval, const Argument &end) | |
Takes the model, the relative speed between two hosts and the interval in which to create key entries. | |
virtual double | getValue (const Argument &pos) const |
Returns the value of the mapping at the passed position. | |
ConstMapping * | constClone () const |
creates a clone of this mapping. | |
Protected Attributes | |
JakesFading * | model |
Pointer to the model. | |
double | relSpeed |
The relative speed between the two hosts for this attenuation. | |
Static Protected Attributes | |
static DimensionSet | dimensions |
The dimensions of this mappings domain. |
Mapping used to represent attenuation of a signal by JakesFading.
Definition at line 29 of file JakesFading.h.
ConstMapping* JakesFadingMapping::constClone | ( | ) | const [inline, virtual] |
creates a clone of this mapping.
This method has to be implemented by every subclass. But most time the implementation will look like the implementation of this method (except of the class name).
Implements SimpleConstMapping.
Definition at line 61 of file JakesFading.h.
References JakesFadingMapping().
{ return new JakesFadingMapping(*this); }
double JakesFadingMapping::getValue | ( | const Argument & | pos | ) | const [virtual] |
Returns the value of the mapping at the passed position.
This method has to be implemented by every subclass and should only have constant complexity.
Implements SimpleConstMapping.
Definition at line 21 of file JakesFading.cc.
References JakesFading::angleOfArrival, JakesFading::carrierFrequency, JakesFading::delay, JakesFading::fadingPaths, Argument::getTime(), M_PI, model, relSpeed, and BaseWorldUtility::speedOfLight.
{ double f = model->carrierFrequency; double v = relSpeed; simtime_t t = pos.getTime(); double re_h = 0; double im_h = 0; // Compute Doppler shift. double doppler_shift = v * f / BaseWorldUtility::speedOfLight; for (int i = 0; i < model->fadingPaths; i++) { // Some math for complex numbers: // // Cartesian form: z = a + ib // Polar form: z = p * e^i(phi) // // a = p * cos(phi) // b = p * sin(phi) // z1 * z2 = p1 * p2 * e^i(phi1 + phi2) // Phase shift due to Doppler => t-selectivity. double phi_d = model->angleOfArrival[i] * doppler_shift; // Phase shift due to delay spread => f-selectivity. double phi_i = model->delay[i].dbl() * f; // Calculate resulting phase due to t-selective and f-selective fading. double phi = 2.00 * M_PI * (phi_d * t.dbl() - phi_i); // One ring model/Clarke's model plus f-selectivity according to Cavers: // Due to isotropic antenna gain pattern on all paths only a^2 can be received on all paths. // Since we are interested in attenuation a:=1, attenuation per path is then: double attenuation = (1.00 / sqrt(static_cast<double>(model->fadingPaths))); // Convert to cartesian form and aggregate {Re, Im} over all fading paths. re_h = re_h + attenuation * cos(phi); im_h = im_h - attenuation * sin(phi); } // Output: |H_f|^2 = absolute channel impulse response due to fading. // Note that this may be >1 due to constructive interference. return re_h * re_h + im_h * im_h; }