A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
trace-fading-loss-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Giuseppe Piro <g.piro@poliba.it>
18 * Marco Miozzo <mmiozzo@cttc.es>
19 */
20
21#ifndef TRACE_FADING_LOSS_MODEL_H
22#define TRACE_FADING_LOSS_MODEL_H
23
25
26#include "ns3/random-variable-stream.h"
27#include <ns3/nstime.h>
28#include <ns3/object.h>
29
30#include <map>
31
32namespace ns3
33{
34
35class MobilityModel;
36
37/**
38 * \ingroup spectrum
39 *
40 * \brief fading loss model based on precalculated fading traces
41 */
43{
44 public:
46 ~TraceFadingLossModel() override;
47
48 /**
49 * \brief Get the type ID.
50 * \return the object TypeId
51 */
52 static TypeId GetTypeId();
53
54 void DoInitialize() override;
55
56 /**
57 * \brief The couple of mobility node that form a fading channel realization
58 */
59 typedef std::pair<Ptr<const MobilityModel>, Ptr<const MobilityModel>> ChannelRealizationId_t;
60
61 protected:
62 int64_t DoAssignStreams(int64_t stream) override;
63
64 private:
65 /**
66 * @param params the spectrum signal parameters.
67 * \param a sender mobility
68 * \param b receiver mobility
69 * \return set of values vs frequency representing the received
70 * power in the same units used for the txPsd parameter.
71 */
74 Ptr<const MobilityModel> b) const override;
75
76 /**
77 * \brief Get the value for a particular sub channel and a given speed
78 * \param subChannel the sub channel for which a value is requested
79 * \param speed the relative speed of the two devices
80 * \return the loss for a particular sub channel
81 */
82 double GetValue(int subChannel, double speed);
83
84 /**
85 * \brief Set the trace file name
86 * \param fileName the trace file
87 */
88 void SetTraceFileName(std::string fileName);
89 /**
90 * \brief Set the trace time
91 * \param t the trace time
92 */
93 void SetTraceLength(Time t);
94
95 /// Load trace function
96 void LoadTrace();
97
98 mutable std::map<ChannelRealizationId_t, int> m_windowOffsetsMap; ///< windows offsets map
99
100 mutable std::map<ChannelRealizationId_t, Ptr<UniformRandomVariable>>
101 m_startVariableMap; ///< start variable map
102
103 /**
104 * Vector with fading samples in time domain (for a fixed RB)
105 */
106 typedef std::vector<double> FadingTraceSample;
107 /**
108 * Vector collecting the time fading traces in the frequency domain (per RB)
109 */
110 typedef std::vector<FadingTraceSample> FadingTrace;
111
112 std::string m_traceFile; ///< the trace file name
113
114 FadingTrace m_fadingTrace; ///< fading trace
115
116 Time m_traceLength; ///< the trace time
117 uint32_t m_samplesNum; ///< number of samples
118 Time m_windowSize; ///< window size
119 uint32_t m_rbNum; ///< RB number
120 mutable Time m_lastWindowUpdate; ///< time of last window update
121 uint32_t m_timeGranularity; ///< time granularity
122 mutable uint64_t m_currentStream; ///< the current stream
123 mutable uint64_t m_lastStream; ///< the last stream
124 uint64_t m_streamSetSize; ///< stream set size
125 mutable bool m_streamsAssigned; ///< is streams assigned?
126};
127
128} // namespace ns3
129
130#endif /* TRACE_FADING_LOSS_MODEL_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
spectrum-aware propagation loss model
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
fading loss model based on precalculated fading traces
uint64_t m_streamSetSize
stream set size
Ptr< SpectrumValue > DoCalcRxPowerSpectralDensity(Ptr< const SpectrumSignalParameters > params, Ptr< const MobilityModel > a, Ptr< const MobilityModel > b) const override
std::string m_traceFile
the trace file name
Time m_lastWindowUpdate
time of last window update
void SetTraceLength(Time t)
Set the trace time.
double GetValue(int subChannel, double speed)
Get the value for a particular sub channel and a given speed.
uint32_t m_samplesNum
number of samples
std::pair< Ptr< const MobilityModel >, Ptr< const MobilityModel > > ChannelRealizationId_t
The couple of mobility node that form a fading channel realization.
int64_t DoAssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
std::vector< double > FadingTraceSample
Vector with fading samples in time domain (for a fixed RB)
uint32_t m_timeGranularity
time granularity
std::vector< FadingTraceSample > FadingTrace
Vector collecting the time fading traces in the frequency domain (per RB)
void SetTraceFileName(std::string fileName)
Set the trace file name.
bool m_streamsAssigned
is streams assigned?
static TypeId GetTypeId()
Get the type ID.
std::map< ChannelRealizationId_t, int > m_windowOffsetsMap
windows offsets map
std::map< ChannelRealizationId_t, Ptr< UniformRandomVariable > > m_startVariableMap
start variable map
uint64_t m_currentStream
the current stream
void LoadTrace()
Load trace function.
FadingTrace m_fadingTrace
fading trace
uint64_t m_lastStream
the last stream
void DoInitialize() override
Initialize() implementation.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.