23 #include "../utils/satellite-env-variables.h"
26 #include <ns3/boolean.h>
28 #include <ns3/singleton.h>
29 #include <ns3/string.h>
31 NS_LOG_COMPONENT_DEFINE(
"SatInterferenceOutputTraceContainer");
36 NS_OBJECT_ENSURE_REGISTERED(SatInterferenceOutputTraceContainer);
41 static TypeId tid = TypeId(
"ns3::SatInterferenceOutputTraceContainer")
43 .AddConstructor<SatInterferenceOutputTraceContainer>();
50 NS_LOG_FUNCTION(
this);
56 : m_enableFigureOutput(true)
58 NS_LOG_FUNCTION(
this);
63 NS_LOG_FUNCTION(
this);
71 NS_LOG_FUNCTION(
this);
75 SatBaseTraceContainer::DoDispose();
81 NS_LOG_FUNCTION(
this);
92 Ptr<SatOutputFileStreamDoubleContainer>
95 NS_LOG_FUNCTION(
this);
97 std::stringstream filename;
98 std::string dataPath = Singleton<SatEnvVariables>::Get()->GetOutputPath();
100 int32_t gwId = Singleton<SatIdMapper>::Get()->GetGwIdWithMac(key.first);
101 int32_t utId = Singleton<SatIdMapper>::Get()->GetUtIdWithMac(key.first);
102 int32_t beamId = Singleton<SatIdMapper>::Get()->GetBeamIdWithMac(key.first);
104 if (beamId < 0 || (utId < 0 && gwId < 0))
110 if (utId >= 0 && gwId < 0)
112 filename << dataPath <<
"/interference_output_trace_BEAM_" << beamId <<
"_UT_" << utId
116 if (gwId >= 0 && utId < 0)
118 filename << dataPath <<
"/interference_output_trace_BEAM_" << beamId <<
"_GW_" << gwId
122 std::pair<container_t::iterator, bool> result =
m_container.insert(
124 CreateObject<SatOutputFileStreamDoubleContainer>(
125 filename.str().c_str(),
129 if (result.second ==
false)
131 NS_FATAL_ERROR(
"SatInterferenceOutputTraceContainer::AddNode failed");
134 NS_LOG_INFO(
"Added node with MAC " << key.first <<
" channel type " << key.second);
136 return result.first->second;
140 Ptr<SatOutputFileStreamDoubleContainer>
143 NS_LOG_FUNCTION(
this);
145 container_t::iterator iter =
m_container.find(key);
158 NS_LOG_FUNCTION(
this);
160 container_t::iterator iter;
166 iter->second->EnableFigureOutput(
"Interference density",
168 "Interference (W / Hz)",
171 Gnuplot2dDataset::LINES_POINTS);
173 iter->second->WriteContainerToFile();
180 NS_LOG_FUNCTION(
this);
185 "SatInterferenceOutputTraceContainer::AddToContainer - Incorrect vector size");
188 Ptr<SatOutputFileStreamDoubleContainer> node =
FindNode(key);
192 node->AddToContainer(newItem);
Base class for trace containers such as interference or fading traces.
static const uint32_t INTF_TRACE_DEFAULT_NUMBER_OF_COLUMNS
Default number of columns for interference traces.
static std::string GetChannelTypeName(ChannelType_t channelType)
TypeId GetInstanceTypeId(void) const
NS-3 instance type id function.
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.