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-converter.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_CONVERTER_H
10
#define SPECTRUM_CONVERTER_H
11
12
#include "
spectrum-value.h
"
13
14
namespace
ns3
15
{
16
17
/**
18
* \ingroup spectrum
19
*
20
* Class which implements a converter between SpectrumValue which are
21
* defined over different SpectrumModel. In more formal terms, this class
22
* allows conversion between different function spaces. In practical
23
* terms, this allows you to mix different spectrum representation
24
* within the same channel, such as a device using a coarse spectrum
25
* representation (e.g., one frequency for each IEEE 802.11 channel)
26
* and devices using a finer representation (e.g., one frequency for
27
* each OFDM subcarrier).
28
*
29
*/
30
class
SpectrumConverter
:
public
SimpleRefCount
<SpectrumConverter>
31
{
32
public
:
33
/**
34
* Create a SpectrumConverter class that will be able to convert ValueVsFreq
35
* instances defined over one SpectrumModel to corresponding ValueVsFreq
36
* instances defined over a different SpectrumModel
37
*
38
* @param fromSpectrumModel the SpectrumModel to convert from
39
* @param toSpectrumModel the SpectrumModel to convert to
40
*/
41
SpectrumConverter
(
Ptr<const SpectrumModel>
fromSpectrumModel,
42
Ptr<const SpectrumModel>
toSpectrumModel);
43
44
SpectrumConverter
();
45
46
/**
47
* Convert a particular ValueVsFreq instance to
48
*
49
* @param vvf the ValueVsFreq instance to be converted
50
*
51
* @return the converted version of the provided ValueVsFreq
52
*/
53
Ptr<SpectrumValue>
Convert
(
Ptr<const SpectrumValue>
vvf)
const
;
54
55
private
:
56
/**
57
* Calculate the coefficient for value conversion between elements
58
*
59
* @param from BandInfo to convert from
60
* @param to BandInfo to convert to
61
*
62
* @return the fraction of the value of the "from" BandInfos that is
63
* mapped to the "to" BandInfo
64
*/
65
double
GetCoefficient
(
const
BandInfo
& from,
const
BandInfo
& to)
const
;
66
67
std::vector<double>
m_conversionMatrix
;
//!< matrix of conversion coefficients stored in
68
//!< Compressed Row Storage format
69
std::vector<size_t>
m_conversionRowPtr
;
//!< offset of rows in m_conversionMatrix
70
std::vector<size_t>
71
m_conversionColInd
;
//!< column of each non-zero element in m_conversionMatrix
72
73
Ptr<const SpectrumModel>
m_fromSpectrumModel
;
//!< the SpectrumModel this SpectrumConverter
74
//!< instance can convert from
75
Ptr<const SpectrumModel>
76
m_toSpectrumModel
;
//!< the SpectrumModel this SpectrumConverter instance can convert to
77
};
78
79
}
// namespace ns3
80
81
#endif
/* SPECTRUM_CONVERTER_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SimpleRefCount
A template-based reference counting class.
Definition
simple-ref-count.h:70
ns3::SpectrumConverter
Class which implements a converter between SpectrumValue which are defined over different SpectrumMod...
Definition
spectrum-converter.h:31
ns3::SpectrumConverter::m_conversionMatrix
std::vector< double > m_conversionMatrix
matrix of conversion coefficients stored in Compressed Row Storage format
Definition
spectrum-converter.h:67
ns3::SpectrumConverter::m_fromSpectrumModel
Ptr< const SpectrumModel > m_fromSpectrumModel
the SpectrumModel this SpectrumConverter instance can convert from
Definition
spectrum-converter.h:73
ns3::SpectrumConverter::GetCoefficient
double GetCoefficient(const BandInfo &from, const BandInfo &to) const
Calculate the coefficient for value conversion between elements.
Definition
spectrum-converter.cc:56
ns3::SpectrumConverter::SpectrumConverter
SpectrumConverter()
Definition
spectrum-converter.cc:21
ns3::SpectrumConverter::m_toSpectrumModel
Ptr< const SpectrumModel > m_toSpectrumModel
the SpectrumModel this SpectrumConverter instance can convert to
Definition
spectrum-converter.h:76
ns3::SpectrumConverter::Convert
Ptr< SpectrumValue > Convert(Ptr< const SpectrumValue > vvf) const
Convert a particular ValueVsFreq instance to.
Definition
spectrum-converter.cc:66
ns3::SpectrumConverter::m_conversionRowPtr
std::vector< size_t > m_conversionRowPtr
offset of rows in m_conversionMatrix
Definition
spectrum-converter.h:69
ns3::SpectrumConverter::m_conversionColInd
std::vector< size_t > m_conversionColInd
column of each non-zero element in m_conversionMatrix
Definition
spectrum-converter.h:71
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
spectrum-value.h
ns3::BandInfo
The building block of a SpectrumModel.
Definition
spectrum-model.h:42
src
spectrum
model
spectrum-converter.h
Generated on Fri Nov 8 2024 13:59:06 for ns-3 by
1.11.0