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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Giuseppe Piro <g.piro@poliba.it>
7 * Marco Miozzo <mmiozzo@cttc.es>
8 */
9
10#ifndef TRACE_FADING_LOSS_MODEL_H
11#define TRACE_FADING_LOSS_MODEL_H
12
14
15#include "ns3/random-variable-stream.h"
16#include <ns3/nstime.h>
17#include <ns3/object.h>
18
19#include <map>
20
21namespace ns3
22{
23
24class MobilityModel;
25
26/**
27 * @ingroup spectrum
28 *
29 * @brief fading loss model based on precalculated fading traces
30 */
32{
33 public:
35 ~TraceFadingLossModel() override;
36
37 /**
38 * @brief Get the type ID.
39 * @return the object TypeId
40 */
41 static TypeId GetTypeId();
42
43 void DoInitialize() override;
44
45 /**
46 * @brief The couple of mobility node that form a fading channel realization
47 */
48 typedef std::pair<Ptr<const MobilityModel>, Ptr<const MobilityModel>> ChannelRealizationId_t;
49
50 protected:
51 int64_t DoAssignStreams(int64_t stream) override;
52
53 private:
54 /**
55 * @param params the spectrum signal parameters.
56 * @param a sender mobility
57 * @param b receiver mobility
58 * @return set of values vs frequency representing the received
59 * power in the same units used for the txPsd parameter.
60 */
63 Ptr<const MobilityModel> b) const override;
64
65 /**
66 * @brief Get the value for a particular sub channel and a given speed
67 * @param subChannel the sub channel for which a value is requested
68 * @param speed the relative speed of the two devices
69 * @return the loss for a particular sub channel
70 */
71 double GetValue(int subChannel, double speed);
72
73 /**
74 * @brief Set the trace file name
75 * @param fileName the trace file
76 */
77 void SetTraceFileName(std::string fileName);
78 /**
79 * @brief Set the trace time
80 * @param t the trace time
81 */
82 void SetTraceLength(Time t);
83
84 /// Load trace function
85 void LoadTrace();
86
87 mutable std::map<ChannelRealizationId_t, int> m_windowOffsetsMap; ///< windows offsets map
88
89 mutable std::map<ChannelRealizationId_t, Ptr<UniformRandomVariable>>
90 m_startVariableMap; ///< start variable map
91
92 /**
93 * Vector with fading samples in time domain (for a fixed RB)
94 */
95 typedef std::vector<double> FadingTraceSample;
96 /**
97 * Vector collecting the time fading traces in the frequency domain (per RB)
98 */
99 typedef std::vector<FadingTraceSample> FadingTrace;
100
101 std::string m_traceFile; ///< the trace file name
102
103 FadingTrace m_fadingTrace; ///< fading trace
104
105 Time m_traceLength; ///< the trace time
106 uint32_t m_samplesNum; ///< number of samples
107 Time m_windowSize; ///< window size
108 uint32_t m_rbNum; ///< RB number
109 mutable Time m_lastWindowUpdate; ///< time of last window update
110 uint32_t m_timeGranularity; ///< time granularity
111 mutable uint64_t m_currentStream; ///< the current stream
112 mutable uint64_t m_lastStream; ///< the last stream
113 uint64_t m_streamSetSize; ///< stream set size
114 mutable bool m_streamsAssigned; ///< is streams assigned?
115};
116
117} // namespace ns3
118
119#endif /* TRACE_FADING_LOSS_MODEL_H */
Smart pointer class similar to boost::intrusive_ptr.
spectrum-aware propagation loss model
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
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:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.