A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::SpectrumModel Class Reference

Set of frequency values implementing the domain of the functions in the Function Space defined by SpectrumValue. More...

#include "spectrum-model.h"

Inheritance diagram for ns3::SpectrumModel:
Collaboration diagram for ns3::SpectrumModel:

Public Member Functions

 SpectrumModel (Bands &&bands)
 This constructs a SpectrumModel based on the explicit values of center frequencies and boundaries of each subband.
 SpectrumModel (const Bands &bands)
 This constructs a SpectrumModel based on the explicit values of center frequencies and boundaries of each subband.
 SpectrumModel (const std::vector< double > &centerFreqs)
 This constructs a SpectrumModel based on a given set of frequencies, which is assumed to be sorted by increasing frequency.
Bands::const_iterator Begin () const
 Const Iterator to the model Bands container start, i.e.
Bands::const_iterator End () const
 Const Iterator to the model Bands container end, i.e.
size_t GetNumBands () const
SpectrumModelUid_t GetUid () const
bool IsAligned (const SpectrumModel &other) const
 Check if another SpectrumModel is aligned with our bands.
bool IsOrthogonal (const SpectrumModel &other) const
 Check if another SpectrumModel has bands orthogonal to our bands.
Public Member Functions inherited from ns3::SimpleRefCount< SpectrumModel >
 SimpleRefCount ()
 Default constructor.
uint32_t GetReferenceCount () const
 Get the reference count of the object.
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
void Ref () const
 Increment the reference count.
void Unref () const
 Decrement the reference count.

Private Member Functions

void InitModel ()
 Initialize internal variables.

Private Attributes

Bands m_bands
 Actual definition of frequency bands within this SpectrumModel.
bool m_contiguousBands
 Whether the bands are contiguous (i.e., no gap between adjacent bands).
SpectrumModelUid_t m_uid
 unique id for a given set of frequencies
bool m_uniqueBandSize
 Whether all bands have the same size.

Static Private Attributes

static SpectrumModelUid_t m_uidCount = 0
 counter to assign m_uids

Friends

bool operator== (const SpectrumModel &lhs, const SpectrumModel &rhs)
 Comparison operator.

Detailed Description

Set of frequency values implementing the domain of the functions in the Function Space defined by SpectrumValue.

Frequency values are in Hz. It is intended that frequency values are non-negative, though this is not enforced.

Definition at line 69 of file spectrum-model.h.

Constructor & Destructor Documentation

◆ SpectrumModel() [1/3]

ns3::SpectrumModel::SpectrumModel ( const std::vector< double > & centerFreqs)

This constructs a SpectrumModel based on a given set of frequencies, which is assumed to be sorted by increasing frequency.

The lower (resp. upper) frequency band limit is determined as the mean value between the center frequency of the considered band and the center frequency of the adjacent lower (resp. upper) band.

Parameters
centerFreqsthe vector of center frequencies.

Definition at line 32 of file spectrum-model.cc.

References ns3::BandInfo::fc, ns3::BandInfo::fh, ns3::BandInfo::fl, InitModel(), m_bands, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by IsAligned(), IsOrthogonal(), and operator==.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SpectrumModel() [2/3]

ns3::SpectrumModel::SpectrumModel ( const Bands & bands)

This constructs a SpectrumModel based on the explicit values of center frequencies and boundaries of each subband.

Parameters
bandsthe vector of bands for this model

Definition at line 63 of file spectrum-model.cc.

References InitModel(), m_bands, and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ SpectrumModel() [3/3]

ns3::SpectrumModel::SpectrumModel ( Bands && bands)

This constructs a SpectrumModel based on the explicit values of center frequencies and boundaries of each subband.

This is used if bands is an rvalue.

Parameters
bandsthe vector of bands for this model

Definition at line 70 of file spectrum-model.cc.

References InitModel(), m_bands, and NS_LOG_FUNCTION.

Here is the call graph for this function:

Member Function Documentation

◆ Begin()

Bands::const_iterator ns3::SpectrumModel::Begin ( ) const

Const Iterator to the model Bands container start, i.e.

to the band with lowest frequency.

Returns
a const iterator to the start of the vector of bands

Definition at line 114 of file spectrum-model.cc.

References m_bands.

Referenced by IsAligned(), and IsOrthogonal().

Here is the caller graph for this function:

◆ End()

Bands::const_iterator ns3::SpectrumModel::End ( ) const

Const Iterator to the model Bands container end, i.e.

after the band with highest frequency.

Returns
a const iterator to past-the-end of the vector of bands

Definition at line 120 of file spectrum-model.cc.

References m_bands.

Referenced by IsAligned(), and IsOrthogonal().

Here is the caller graph for this function:

◆ GetNumBands()

size_t ns3::SpectrumModel::GetNumBands ( ) const
Returns
the number of frequencies in this SpectrumModel

Definition at line 126 of file spectrum-model.cc.

References m_bands.

◆ GetUid()

SpectrumModelUid_t ns3::SpectrumModel::GetUid ( ) const
Returns
the unique id of this SpectrumModel

Definition at line 132 of file spectrum-model.cc.

References m_uid.

◆ InitModel()

void ns3::SpectrumModel::InitModel ( )
private

Initialize internal variables.

Definition at line 78 of file spectrum-model.cc.

References m_bands, m_contiguousBands, m_uid, m_uidCount, m_uniqueBandSize, and NS_LOG_INFO.

Referenced by SpectrumModel(), SpectrumModel(), and SpectrumModel().

Here is the caller graph for this function:

◆ IsAligned()

bool ns3::SpectrumModel::IsAligned ( const SpectrumModel & other) const

Check if another SpectrumModel is aligned with our bands.

This means that both SpectrumModels have boundaries for each band that are common between the two models. In this case, the conversion between the two models is just a matter of copying values in the overlapping bands and setting to zero the values in the non-overlapping bands.

Parameters
otheranother SpectrumModel
Returns
true if bands are aligned

Definition at line 159 of file spectrum-model.cc.

References SpectrumModel(), Begin(), End(), m_bands, and m_uniqueBandSize.

Here is the call graph for this function:

◆ IsOrthogonal()

bool ns3::SpectrumModel::IsOrthogonal ( const SpectrumModel & other) const

Check if another SpectrumModel has bands orthogonal to our bands.

Parameters
otheranother SpectrumModel
Returns
true if bands are orthogonal

Definition at line 138 of file spectrum-model.cc.

References SpectrumModel(), Begin(), End(), m_bands, and m_contiguousBands.

Here is the call graph for this function:

◆ operator==

bool operator== ( const SpectrumModel & lhs,
const SpectrumModel & rhs )
friend

Comparison operator.

Returns true if the two SpectrumModels are identical

Parameters
lhsleft operand
rhsright operand
Returns
true if the two operands are identical

Definition at line 25 of file spectrum-model.cc.

References SpectrumModel(), and m_uid.

Member Data Documentation

◆ m_bands

Bands ns3::SpectrumModel::m_bands
private

Actual definition of frequency bands within this SpectrumModel.

Definition at line 159 of file spectrum-model.h.

Referenced by SpectrumModel(), SpectrumModel(), SpectrumModel(), Begin(), End(), GetNumBands(), InitModel(), IsAligned(), and IsOrthogonal().

◆ m_contiguousBands

bool ns3::SpectrumModel::m_contiguousBands
private

Whether the bands are contiguous (i.e., no gap between adjacent bands).

Definition at line 160 of file spectrum-model.h.

Referenced by InitModel(), and IsOrthogonal().

◆ m_uid

SpectrumModelUid_t ns3::SpectrumModel::m_uid
private

unique id for a given set of frequencies

Definition at line 163 of file spectrum-model.h.

Referenced by GetUid(), InitModel(), and operator==.

◆ m_uidCount

SpectrumModelUid_t ns3::SpectrumModel::m_uidCount = 0
staticprivate

counter to assign m_uids

Definition at line 164 of file spectrum-model.h.

Referenced by InitModel().

◆ m_uniqueBandSize

bool ns3::SpectrumModel::m_uniqueBandSize
private

Whether all bands have the same size.

Definition at line 162 of file spectrum-model.h.

Referenced by InitModel(), and IsAligned().


The documentation for this class was generated from the following files: