A Discrete-Event Network Simulator
lorawan @ (+)
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
l
m
n
o
p
q
r
s
t
w
Enumerator
a
b
c
d
e
f
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
Related Symbols
:
a
b
c
d
e
g
h
i
j
l
m
n
o
p
q
r
s
t
u
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
e
l
v
Macros
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
▼
ns-3
►
ns-3 Documentation
►
All Environment Variables
Todo List
Deprecated List
Bug List
►
Topics
►
Namespaces
►
Classes
▼
Files
▼
File List
►
doc
►
examples
▼
src
►
antenna
►
aodv
►
applications
►
bridge
►
brite
►
buildings
►
click
►
config-store
►
core
►
csma
►
csma-layout
►
dsdv
►
dsr
►
energy
►
fd-net-device
►
flow-monitor
►
internet
►
internet-apps
►
lorawan
►
lr-wpan
►
lte
►
mesh
►
mobility
►
mpi
►
netanim
►
network
►
nix-vector-routing
►
olsr
►
openflow
►
point-to-point
►
point-to-point-layout
►
propagation
►
sixlowpan
▼
spectrum
►
examples
►
helper
▼
model
aloha-noack-mac-header.cc
aloha-noack-mac-header.h
►
aloha-noack-net-device.cc
aloha-noack-net-device.h
constant-spectrum-propagation-loss.cc
constant-spectrum-propagation-loss.h
friis-spectrum-propagation-loss.cc
friis-spectrum-propagation-loss.h
half-duplex-ideal-phy-signal-parameters.cc
half-duplex-ideal-phy-signal-parameters.h
►
half-duplex-ideal-phy.cc
half-duplex-ideal-phy.h
►
ism-spectrum-value-helper.cc
ism-spectrum-value-helper.h
matrix-based-channel-model.cc
►
matrix-based-channel-model.h
►
microwave-oven-spectrum-value-helper.cc
microwave-oven-spectrum-value-helper.h
►
multi-model-spectrum-channel.cc
►
multi-model-spectrum-channel.h
non-communicating-net-device.cc
non-communicating-net-device.h
phased-array-spectrum-propagation-loss-model.cc
phased-array-spectrum-propagation-loss-model.h
single-model-spectrum-channel.cc
single-model-spectrum-channel.h
spectrum-analyzer.cc
spectrum-analyzer.h
spectrum-channel.cc
spectrum-channel.h
spectrum-converter.cc
spectrum-converter.h
spectrum-error-model.cc
spectrum-error-model.h
spectrum-interference.cc
spectrum-interference.h
►
spectrum-model-300kHz-300GHz-log.cc
spectrum-model-300kHz-300GHz-log.h
►
spectrum-model-ism2400MHz-res1MHz.cc
spectrum-model-ism2400MHz-res1MHz.h
►
spectrum-model.cc
►
spectrum-model.h
spectrum-phy.cc
spectrum-phy.h
spectrum-propagation-loss-model.cc
spectrum-propagation-loss-model.h
spectrum-signal-parameters.cc
spectrum-signal-parameters.h
spectrum-transmit-filter.cc
spectrum-transmit-filter.h
►
spectrum-value.cc
►
spectrum-value.h
►
three-gpp-channel-model.cc
►
three-gpp-channel-model.h
three-gpp-spectrum-propagation-loss-model.cc
►
three-gpp-spectrum-propagation-loss-model.h
trace-fading-loss-model.cc
trace-fading-loss-model.h
►
tv-spectrum-transmitter.cc
tv-spectrum-transmitter.h
►
two-ray-spectrum-propagation-loss-model.cc
►
two-ray-spectrum-propagation-loss-model.h
waveform-generator.cc
waveform-generator.h
►
test
►
utils
►
stats
►
tap-bridge
►
test
►
topology-read
►
traffic-control
►
uan
►
virtual-net-device
►
visualizer
►
wifi
►
wimax
►
utils
►
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
spectrum-model.cc
Go to the documentation of this file.
1
2
/*
3
* Copyright (c) 2009 CTTC
4
*
5
* SPDX-License-Identifier: GPL-2.0-only
6
*
7
* Author: Nicola Baldo <nbaldo@cttc.es>
8
*/
9
10
#include "
spectrum-model.h
"
11
12
#include <ns3/assert.h>
13
#include <ns3/log.h>
14
15
#include <cmath>
16
#include <cstddef>
17
18
namespace
ns3
19
{
20
21
NS_LOG_COMPONENT_DEFINE
(
"SpectrumModel"
);
22
23
bool
24
operator==
(
const
SpectrumModel
& lhs,
const
SpectrumModel
& rhs)
25
{
26
return
(lhs.
m_uid
== rhs.
m_uid
);
27
}
24
operator==
(
const
SpectrumModel
& lhs,
const
SpectrumModel
& rhs) {
…
};
28
29
SpectrumModelUid_t
SpectrumModel::m_uidCount
= 0;
30
31
SpectrumModel::SpectrumModel
(
const
std::vector<double>& centerFreqs)
32
{
33
NS_ASSERT
(centerFreqs.size() > 1);
34
m_uid
= ++
m_uidCount
;
35
36
for
(
auto
it = centerFreqs.begin(); it != centerFreqs.end(); ++it)
37
{
38
BandInfo
e;
39
e.
fc
= *it;
40
if
(it == centerFreqs.begin())
41
{
42
double
delta = ((*(it + 1)) - (*it)) / 2;
43
e.
fl
= *it - delta;
44
e.
fh
= *it + delta;
45
}
46
else
if
(it == centerFreqs.end() - 1)
47
{
48
double
delta = ((*it) - (*(it - 1))) / 2;
49
e.
fl
= *it - delta;
50
e.
fh
= *it + delta;
51
}
52
else
53
{
54
e.
fl
= ((*it) + (*(it - 1))) / 2;
55
e.
fh
= ((*(it + 1)) + (*it)) / 2;
56
}
57
m_bands
.push_back(e);
58
}
59
}
31
SpectrumModel::SpectrumModel
(
const
std::vector<double>& centerFreqs) {
…
}
60
61
SpectrumModel::SpectrumModel
(
const
Bands
& bands)
62
{
63
m_uid
= ++
m_uidCount
;
64
NS_LOG_INFO
(
"creating new SpectrumModel, m_uid="
<<
m_uid
);
65
m_bands
= bands;
66
}
61
SpectrumModel::SpectrumModel
(
const
Bands
& bands) {
…
}
67
68
SpectrumModel::SpectrumModel
(
Bands
&& bands)
69
: m_bands(
std
::move(bands))
70
{
71
m_uid
= ++
m_uidCount
;
72
NS_LOG_INFO
(
"creating new SpectrumModel, m_uid="
<<
m_uid
);
73
}
68
SpectrumModel::SpectrumModel
(
Bands
&& bands) {
…
}
74
75
Bands::const_iterator
76
SpectrumModel::Begin
()
const
77
{
78
return
m_bands
.begin();
79
}
76
SpectrumModel::Begin
()
const
{
…
}
80
81
Bands::const_iterator
82
SpectrumModel::End
()
const
83
{
84
return
m_bands
.end();
85
}
82
SpectrumModel::End
()
const
{
…
}
86
87
size_t
88
SpectrumModel::GetNumBands
()
const
89
{
90
return
m_bands
.size();
91
}
88
SpectrumModel::GetNumBands
()
const
{
…
}
92
93
SpectrumModelUid_t
94
SpectrumModel::GetUid
()
const
95
{
96
return
m_uid
;
97
}
94
SpectrumModel::GetUid
()
const
{
…
}
98
99
bool
100
SpectrumModel::IsOrthogonal
(
const
SpectrumModel
& other)
const
101
{
102
for
(
auto
myIt =
Begin
(); myIt !=
End
(); ++myIt)
103
{
104
for
(
auto
otherIt = other.
Begin
(); otherIt != other.
End
(); ++otherIt)
105
{
106
if
(std::max(myIt->fl, otherIt->fl) < std::min(myIt->fh, otherIt->fh))
107
{
108
return
false
;
109
}
110
}
111
}
112
return
true
;
113
}
100
SpectrumModel::IsOrthogonal
(
const
SpectrumModel
& other)
const
{
…
}
114
115
}
// namespace ns3
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::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
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition
assert.h:55
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition
log.h:264
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator==
bool operator==(const EventId &a, const EventId &b)
Definition
event-id.h:155
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
std
STL namespace.
spectrum-model.h
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.cc
Generated on Mon Jan 27 2025 16:35:52 for ns-3 by
1.11.0