26#include "ns3/boolean.h"
28#include "ns3/singleton.h"
29#include "ns3/string.h"
38NS_LOG_COMPONENT_DEFINE(
"SatInterferenceOutputTraceContainer");
48 static TypeId tid = TypeId(
"ns3::SatInterferenceOutputTraceContainer")
50 .AddConstructor<SatInterferenceOutputTraceContainer>();
57 NS_LOG_FUNCTION(
this);
62 NS_LOG_FUNCTION(
this);
70 NS_LOG_FUNCTION(
this);
74 SatBaseTraceContainer::DoDispose();
80 NS_LOG_FUNCTION(
this);
91Ptr<SatOutputFileStreamDoubleContainer>
94 NS_LOG_FUNCTION(
this);
96 std::stringstream filename;
99 int32_t gwId = Singleton<SatIdMapper>::Get()->GetGwIdWithMac(key.first);
100 int32_t utId = Singleton<SatIdMapper>::Get()->GetUtIdWithMac(key.first);
101 int32_t beamId = Singleton<SatIdMapper>::Get()->GetBeamIdWithMac(key.first);
103 if (beamId < 0 || (utId < 0 && gwId < 0))
109 if (utId >= 0 && gwId < 0)
111 filename << dataPath <<
"/interference_output_trace_BEAM_" << beamId <<
"_UT_" << utId
115 if (gwId >= 0 && utId < 0)
117 filename << dataPath <<
"/interference_output_trace_BEAM_" << beamId <<
"_GW_" << gwId
121 std::pair<container_t::iterator, bool> result =
m_container.insert(
123 CreateObject<SatOutputFileStreamDoubleContainer>(
124 filename.str().c_str(),
128 if (result.second ==
false)
130 NS_FATAL_ERROR(
"SatInterferenceOutputTraceContainer::AddNode failed");
133 NS_LOG_INFO(
"Added node with MAC " << key.first <<
" channel type " << key.second);
135 return result.first->second;
139Ptr<SatOutputFileStreamDoubleContainer>
142 NS_LOG_FUNCTION(
this);
144 container_t::iterator iter =
m_container.find(key);
157 NS_LOG_FUNCTION(
this);
159 container_t::iterator iter;
165 iter->second->EnableFigureOutput(
"Interference density",
167 "Interference (W / Hz)",
170 Gnuplot2dDataset::LINES_POINTS);
172 iter->second->WriteContainerToFile();
179 NS_LOG_FUNCTION(
this);
184 "SatInterferenceOutputTraceContainer::AddToContainer - Incorrect vector size");
187 Ptr<SatOutputFileStreamDoubleContainer> node =
FindNode(key);
191 node->AddToContainer(newItem);
SatBaseTraceContainer()
Constructor.
static const uint32_t INTF_TRACE_DEFAULT_NUMBER_OF_COLUMNS
Default number of columns for interference traces.
static std::string GetChannelTypeName(ChannelType_t channelType)
static Ptr< SatEnvVariables > GetInstance()
Class for interference output trace container.
bool m_enableFigureOutput
Switch for figure output.
std::pair< Address, SatEnums::ChannelType_t > key_t
typedef for map key
void Reset()
Function for resetting the variables.
Ptr< SatOutputFileStreamDoubleContainer > FindNode(key_t key)
Function for finding the container matching the key.
void DoDispose()
Do needed dispose actions.
Ptr< SatOutputFileStreamDoubleContainer > AddNode(std::pair< Address, SatEnums::ChannelType_t > key)
Function for adding the node to the map.
~SatInterferenceOutputTraceContainer()
Destructor.
SatInterferenceOutputTraceContainer()
Constructor.
container_t m_container
Map for containers.
void AddToContainer(key_t key, std::vector< double > newItem)
Add the vector containing the values to container matching the key.
static TypeId GetTypeId(void)
NS-3 type id function.
void WriteToFile()
Write the contents of a container matching to the key into a file.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.