A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-chunk-processor.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Nicola Baldo <nbaldo@cttc.es>
7 * Modified by : Marco Miozzo <mmiozzo@cttc.es>
8 * (move from CQI to Ctrl and Data SINR Chunk processors
9 */
10
11#include "lte-chunk-processor.h"
12
13#include <ns3/log.h>
14#include <ns3/spectrum-value.h>
15
16namespace ns3
17{
18
19NS_LOG_COMPONENT_DEFINE("LteChunkProcessor");
20
25
30
31void
37
38void
45
46void
48{
49 NS_LOG_FUNCTION(this << sinr << duration);
50 if (!m_sumValues)
51 {
53 }
54 (*m_sumValues) += sinr * duration.GetSeconds();
55 m_totDuration += duration;
56}
57
58void
60{
61 NS_LOG_FUNCTION(this);
62 if (m_totDuration.GetSeconds() > 0)
63 {
64 for (auto it = m_lteChunkProcessorCallbacks.begin();
66 it++)
67 {
68 (*it)((*m_sumValues) / m_totDuration.GetSeconds());
69 }
70 }
71 else
72 {
73 NS_LOG_WARN("m_numSinr == 0");
74 }
75}
76
77void
79{
80 m_value = value.Copy();
81}
82
88
89} // namespace ns3
Callback template class.
Definition callback.h:422
virtual void Start()
Clear internal variables.
virtual void AddCallback(LteChunkProcessorCallback c)
Add callback to list.
virtual void EvaluateChunk(const SpectrumValue &sinr, Time duration)
Collect SpectrumValue and duration of signal.
Ptr< SpectrumValue > m_sumValues
sum values
Time m_totDuration
total duration
std::vector< LteChunkProcessorCallback > m_lteChunkProcessorCallbacks
chunk processor callback
virtual void End()
Finish calculation and inform interested objects about calculated value.
Ptr< SpectrumValue > m_value
spectrum value
Ptr< SpectrumValue > GetValue()
void ReportValue(const SpectrumValue &value)
function to be plugged to LteChunkProcessor::AddCallback ()
Smart pointer class similar to boost::intrusive_ptr.
Set of values corresponding to a given SpectrumModel.
Ptr< const SpectrumModel > GetSpectrumModel() const
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:392
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition log.h:250
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1368
Every class exported by the ns3 library is enclosed in the ns3 namespace.