A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
spectrum-model.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 CTTC
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Nicola Baldo <nbaldo@cttc.es>
7
*/
8
9
#ifndef SPECTRUM_MODEL_H
10
#define SPECTRUM_MODEL_H
11
12
#include <ns3/simple-ref-count.h>
13
14
#include <cstddef>
15
#include <vector>
16
17
namespace
ns3
18
{
19
20
/**
21
* \defgroup spectrum Spectrum Models
22
*/
23
24
/**
25
* \ingroup spectrum
26
* \ingroup tests
27
* \defgroup spectrum-tests Spectrum Models tests
28
*/
29
30
/**
31
* \ingroup spectrum
32
*
33
* The building block of a SpectrumModel. This struct models
34
* a frequency band defined by the frequency interval [fl, fc] and
35
* with center frequency fc. Typically, the center frequency will be
36
* used for stuff such as propagation modeling, while the interval
37
* boundaries will be used for bandwidth calculation and for
38
* conversion between different SpectrumRepresentations.
39
*
40
*/
41
struct
BandInfo
42
{
43
double
fl
;
//!< lower limit of subband
44
double
fc
;
//!< center frequency
45
double
fh
;
//!< upper limit of subband
46
};
47
48
/// Container of BandInfo
49
typedef
std::vector<BandInfo>
Bands
;
50
51
/// Uid for SpectrumModels
52
typedef
uint32_t
SpectrumModelUid_t
;
53
54
/**
55
* Set of frequency values implementing the domain of the functions in
56
* the Function Space defined by SpectrumValue. Frequency values are in
57
* Hz. It is intended that frequency values are non-negative, though
58
* this is not enforced.
59
*
60
*/
61
class
SpectrumModel
:
public
SimpleRefCount
<SpectrumModel>
62
{
63
public
:
64
/**
65
* Comparison operator. Returns true if the two SpectrumModels are identical
66
* \param lhs left operand
67
* \param rhs right operand
68
* \returns true if the two operands are identical
69
*/
70
friend
bool
operator==
(
const
SpectrumModel
& lhs,
const
SpectrumModel
& rhs);
71
72
/**
73
* This constructs a SpectrumModel based on a given set of frequencies,
74
* which is assumed to be sorted by increasing frequency. The lower
75
* (resp. upper) frequency band limit is determined as the mean value
76
* between the center frequency of the considered band and the
77
* center frequency of the adjacent lower (resp. upper) band.
78
*
79
* @param centerFreqs the vector of center frequencies.
80
*/
81
SpectrumModel
(
const
std::vector<double>& centerFreqs);
82
83
/**
84
* This constructs a SpectrumModel based on the explicit values of
85
* center frequencies and boundaries of each subband.
86
*
87
* @param bands the vector of bands for this model
88
*/
89
SpectrumModel
(
const
Bands
& bands);
90
91
/**
92
* This constructs a SpectrumModel based on the explicit values of
93
* center frequencies and boundaries of each subband. This is used
94
* if <i>bands</i> is an rvalue.
95
*
96
* @param bands the vector of bands for this model
97
*/
98
SpectrumModel
(
Bands
&& bands);
99
100
/**
101
*
102
* @return the number of frequencies in this SpectrumModel
103
*/
104
size_t
GetNumBands
()
const
;
105
106
/**
107
*
108
* @return the unique id of this SpectrumModel
109
*/
110
SpectrumModelUid_t
GetUid
()
const
;
111
112
/**
113
* Const Iterator to the model Bands container start.
114
*
115
* @return a const iterator to the start of the vector of bands
116
*/
117
Bands::const_iterator
Begin
()
const
;
118
/**
119
* Const Iterator to the model Bands container end.
120
*
121
* @return a const iterator to past-the-end of the vector of bands
122
*/
123
Bands::const_iterator
End
()
const
;
124
125
/**
126
* Check if another SpectrumModels has bands orthogonal to our bands.
127
*
128
* \param other another SpectrumModel
129
* \returns true if bands are orthogonal
130
*/
131
bool
IsOrthogonal
(
const
SpectrumModel
& other)
const
;
132
133
private
:
134
Bands
m_bands
;
//!< Actual definition of frequency bands within this SpectrumModel
135
SpectrumModelUid_t
m_uid
;
//!< unique id for a given set of frequencies
136
static
SpectrumModelUid_t
m_uidCount
;
//!< counter to assign m_uids
137
};
138
139
}
// namespace ns3
140
141
#endif
/* SPECTRUM_MODEL_H */
ns3::SimpleRefCount
A template-based reference counting class.
Definition
simple-ref-count.h:70
ns3::SpectrumModel
Set of frequency values implementing the domain of the functions in the Function Space defined by Spe...
Definition
spectrum-model.h:62
ns3::SpectrumModel::operator==
friend bool operator==(const SpectrumModel &lhs, const SpectrumModel &rhs)
Comparison operator.
Definition
spectrum-model.cc:24
ns3::SpectrumModel::IsOrthogonal
bool IsOrthogonal(const SpectrumModel &other) const
Check if another SpectrumModels has bands orthogonal to our bands.
Definition
spectrum-model.cc:100
ns3::SpectrumModel::m_uidCount
static SpectrumModelUid_t m_uidCount
counter to assign m_uids
Definition
spectrum-model.h:136
ns3::SpectrumModel::m_uid
SpectrumModelUid_t m_uid
unique id for a given set of frequencies
Definition
spectrum-model.h:135
ns3::SpectrumModel::SpectrumModel
SpectrumModel(const std::vector< double > ¢erFreqs)
This constructs a SpectrumModel based on a given set of frequencies, which is assumed to be sorted by...
Definition
spectrum-model.cc:31
ns3::SpectrumModel::End
Bands::const_iterator End() const
Const Iterator to the model Bands container end.
Definition
spectrum-model.cc:82
ns3::SpectrumModel::GetNumBands
size_t GetNumBands() const
Definition
spectrum-model.cc:88
ns3::SpectrumModel::Begin
Bands::const_iterator Begin() const
Const Iterator to the model Bands container start.
Definition
spectrum-model.cc:76
ns3::SpectrumModel::GetUid
SpectrumModelUid_t GetUid() const
Definition
spectrum-model.cc:94
ns3::SpectrumModel::m_bands
Bands m_bands
Actual definition of frequency bands within this SpectrumModel.
Definition
spectrum-model.h:134
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Bands
std::vector< BandInfo > Bands
Container of BandInfo.
Definition
spectrum-model.h:49
ns3::SpectrumModelUid_t
uint32_t SpectrumModelUid_t
Uid for SpectrumModels.
Definition
spectrum-model.h:52
ns3::BandInfo
The building block of a SpectrumModel.
Definition
spectrum-model.h:42
ns3::BandInfo::fc
double fc
center frequency
Definition
spectrum-model.h:44
ns3::BandInfo::fl
double fl
lower limit of subband
Definition
spectrum-model.h:43
ns3::BandInfo::fh
double fh
upper limit of subband
Definition
spectrum-model.h:45
src
spectrum
model
spectrum-model.h
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0