|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
25 #include "ns3/net-device.h"
26 #include "ns3/phased-array-model.h"
28 #include "ns3/channel-condition-model.h"
29 #include "ns3/double.h"
30 #include "ns3/string.h"
31 #include "ns3/simulator.h"
32 #include "ns3/pointer.h"
44 m_uniformRv = CreateObject<UniformRandomVariable> ();
64 static TypeId tid =
TypeId (
"ns3::ThreeGppSpectrumPropagationLossModel")
66 .SetGroupName (
"Spectrum")
68 .AddAttribute(
"ChannelModel",
69 "The channel model. It needs to implement the MatrixBasedChannelModel interface",
73 MakePointerChecker<MatrixBasedChannelModel> ())
74 .AddAttribute (
"vScatt",
75 "Maximum speed of the vehicle in the layout (see 3GPP TR 37.885 v15.3.0, Sec. 6.2.3)."
76 "Used to compute the additional contribution for the Doppler of"
77 "delayed (reflected) paths",
80 MakeDoubleChecker<double> (0.0))
131 uint16_t sAntenna =
static_cast<uint16_t
> (sW.size ());
132 uint16_t uAntenna =
static_cast<uint16_t
> (uW.size ());
134 NS_LOG_DEBUG (
"CalcLongTerm with sAntenna " << sAntenna <<
" uAntenna " << uAntenna);
138 uint8_t numCluster =
static_cast<uint8_t
> (params->m_channel[0][0].size ());
140 for (uint8_t cIndex = 0; cIndex < numCluster; cIndex++)
142 std::complex<double> txSum (0,0);
143 for (uint16_t sIndex = 0; sIndex < sAntenna; sIndex++)
145 std::complex<double> rxSum (0,0);
146 for (uint16_t uIndex = 0; uIndex < uAntenna; uIndex++)
148 rxSum = rxSum + uW[uIndex] * params->m_channel[uIndex][sIndex][cIndex];
150 txSum = txSum + sW[sIndex] * rxSum;
152 longTerm.push_back (txSum);
161 const ns3::Vector &sSpeed,
const ns3::Vector &uSpeed)
const
168 uint8_t numCluster =
static_cast<uint8_t
> (params->m_channel[0][0].size ());
175 for (uint8_t cIndex = 0; cIndex < numCluster; cIndex++)
203 doppler.push_back (exp (std::complex<double> (0, temp_doppler)));
212 std::complex<double> subsbandGain (0.0,0.0);
215 double fsb = (*sbit).fc;
216 for (uint8_t cIndex = 0; cIndex < numCluster; cIndex++)
218 double delay = -2 * M_PI * fsb * (params->m_delay[cIndex]);
219 subsbandGain = subsbandGain + longTerm[cIndex] * doppler[cIndex] * exp (std::complex<double> (0, delay));
221 *vit = (*vit) * (
norm (subsbandGain));
240 if (!channelMatrix->IsReverse (aId, bId))
257 bool notFound =
false;
262 NS_LOG_DEBUG (
"found the long term component in the map");
268 update = (
m_longTermMap[longTermId]->m_channel->m_generatedTime != channelMatrix->m_generatedTime
279 if (update || notFound)
289 longTermItem->
m_sW = sW;
290 longTermItem->
m_uW = uW;
304 uint32_t aId = a->GetObject<
Node> ()->GetId ();
305 uint32_t bId = b->GetObject<
Node> ()->GetId ();
308 NS_ASSERT_MSG (a->GetDistanceFrom (b) > 0.0,
"The position of a and b devices cannot be the same");
315 NS_LOG_DEBUG (
"a node " << a->GetObject<
Node> () <<
" antenna " << aAntenna);
320 NS_LOG_DEBUG (
"b node " << bId <<
" antenna " << bAntenna);
332 rxPsd =
CalcBeamformingGain (rxPsd, longTerm, channelMatrix, a->GetVelocity (), b->GetVelocity ());
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void GetChannelModelAttribute(const std::string &name, AttributeValue &value) const
Returns the value of an attribute belonging to the associated MatrixBasedChannelModel instance.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
void AddDevice(Ptr< NetDevice > n, Ptr< const PhasedArrayModel > a)
Add a device-antenna pair.
ThreeGppSpectrumPropagationLossModel()
Constructor.
static const uint8_t ZOA_INDEX
index of the ZOA value in the m_angle array
Values::iterator ValuesBegin()
static Time Now(void)
Return the current simulation virtual time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< SpectrumValue > CalcBeamformingGain(Ptr< SpectrumValue > txPsd, PhasedArrayModel::ComplexVector longTerm, Ptr< const MatrixBasedChannelModel::ChannelMatrix > params, const Vector &sSpeed, const Vector &uSpeed) const
Computes the beamforming gain and applies it to the tx PSD.
PhasedArrayModel::ComplexVector m_longTerm
vector containing the long term component for each cluster
void DoDispose() override
Destructor implementation.
Hold a value for an Attribute.
static const uint8_t AOA_INDEX
index of the AOA value in the m_angle array
void SetChannelModel(Ptr< MatrixBasedChannelModel > channel)
Set the channel model object.
spectrum-aware propagation loss model
~ThreeGppSpectrumPropagationLossModel()
Destructor.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
static constexpr uint32_t GetKey(uint32_t x1, uint32_t x2)
Calculate the channel key using the Cantor function.
Ptr< SpectrumValue > DoCalcRxPowerSpectralDensity(Ptr< const SpectrumValue > txPsd, Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
Computes the received PSD.
Smart pointer class similar to boost::intrusive_ptr.
std::unordered_map< uint32_t, Ptr< const LongTerm > > m_longTermMap
map containing the long term components
static const uint8_t ZOD_INDEX
index of the ZOD value in the m_angle array
PhasedArrayModel::ComplexVector GetLongTerm(uint32_t aId, uint32_t bId, Ptr< const MatrixBasedChannelModel::ChannelMatrix > channelMatrix, const PhasedArrayModel::ComplexVector &aW, const PhasedArrayModel::ComplexVector &bW) const
Looks for the long term component in m_longTermMap.
PhasedArrayModel::ComplexVector m_sW
the beamforming vector for the node s used to compute the long term
static TypeId GetTypeId()
Get the type ID.
Values::iterator ValuesEnd()
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< UniformRandomVariable > m_uniformRv
uniform random variable, used to compute the additional Doppler contribution
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Hold variables of type string.
Bands::const_iterator ConstBandsBegin() const
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
static const uint8_t AOD_INDEX
index of the AOD value in the m_angle array
PhasedArrayModel::ComplexVector m_uW
the beamforming vector for the node u used to compute the long term
PhasedArrayModel::ComplexVector CalcLongTerm(Ptr< const MatrixBasedChannelModel::ChannelMatrix > channelMatrix, const PhasedArrayModel::ComplexVector &sW, const PhasedArrayModel::ComplexVector &uW) const
Computes the long term component.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
double GetFrequency() const
Get the operating frequency.
double m_vScatt
value used to compute the additional Doppler contribution for the delayed paths
Ptr< MatrixBasedChannelModel > m_channelModel
the model to generate the channel matrix
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
const double norm
Normalization to obtain randoms on [0,1).
Ptr< const MatrixBasedChannelModel::ChannelMatrix > m_channel
pointer to the channel matrix used to compute the long term
std::unordered_map< uint32_t, Ptr< const PhasedArrayModel > > m_deviceAntennaMap
map containig the <node, antenna> associations
3GPP Spectrum Propagation Loss Model
std::vector< std::complex< double > > ComplexVector
type definition for complex vectors
void SetChannelModelAttribute(const std::string &name, const AttributeValue &value)
Sets the value of an attribute belonging to the associated MatrixBasedChannelModel instance.
Ptr< MatrixBasedChannelModel > GetChannelModel() const
Get the channel model object.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.