A Discrete-Event Network Simulator
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
14namespace 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 */
30class 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 */
42 Ptr<const SpectrumModel> toSpectrumModel);
43
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 */
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
76 m_toSpectrumModel; //!< the SpectrumModel this SpectrumConverter instance can convert to
77};
78
79} // namespace ns3
80
81#endif /* SPECTRUM_CONVERTER_H */
Smart pointer class similar to boost::intrusive_ptr.
A template-based reference counting class.
Class which implements a converter between SpectrumValue which are defined over different SpectrumMod...
std::vector< double > m_conversionMatrix
matrix of conversion coefficients stored in Compressed Row Storage format
Ptr< const SpectrumModel > m_fromSpectrumModel
the SpectrumModel this SpectrumConverter instance can convert from
double GetCoefficient(const BandInfo &from, const BandInfo &to) const
Calculate the coefficient for value conversion between elements.
Ptr< const SpectrumModel > m_toSpectrumModel
the SpectrumModel this SpectrumConverter instance can convert to
Ptr< SpectrumValue > Convert(Ptr< const SpectrumValue > vvf) const
Convert a particular ValueVsFreq instance to.
std::vector< size_t > m_conversionRowPtr
offset of rows in m_conversionMatrix
std::vector< size_t > m_conversionColInd
column of each non-zero element in m_conversionMatrix
Every class exported by the ns3 library is enclosed in the ns3 namespace.
The building block of a SpectrumModel.