23 #include "../utils/satellite-env-variables.h"
26 #include <ns3/boolean.h>
28 #include <ns3/singleton.h>
29 #include <ns3/string.h>
38 NS_LOG_COMPONENT_DEFINE(
"SatFadingOutputTraceContainer");
43 NS_OBJECT_ENSURE_REGISTERED(SatFadingOutputTraceContainer);
48 static TypeId tid = TypeId(
"ns3::SatFadingOutputTraceContainer")
50 .AddConstructor<SatFadingOutputTraceContainer>();
57 NS_LOG_FUNCTION(
this);
63 : m_enableFigureOutput(true)
65 NS_LOG_FUNCTION(
this);
70 NS_LOG_FUNCTION(
this);
78 NS_LOG_FUNCTION(
this);
82 SatBaseTraceContainer::DoDispose();
88 NS_LOG_FUNCTION(
this);
99 Ptr<SatOutputFileStreamDoubleContainer>
102 NS_LOG_FUNCTION(
this);
104 std::stringstream filename;
105 std::string dataPath = Singleton<SatEnvVariables>::Get()->GetOutputPath();
107 int32_t gwId = Singleton<SatIdMapper>::Get()->GetGwIdWithMac(key.first);
108 int32_t utId = Singleton<SatIdMapper>::Get()->GetUtIdWithMac(key.first);
109 int32_t beamId = Singleton<SatIdMapper>::Get()->GetBeamIdWithMac(key.first);
111 if (beamId < 0 || (utId < 0 && gwId < 0))
117 if (utId >= 0 && gwId < 0)
119 filename << dataPath <<
"/fading_output_trace_BEAM_" << beamId <<
"_UT_" << utId
123 if (gwId >= 0 && utId < 0)
125 filename << dataPath <<
"/fading_output_trace_BEAM_" << beamId <<
"_GW_" << gwId
129 std::pair<container_t::iterator, bool> result =
m_container.insert(
131 CreateObject<SatOutputFileStreamDoubleContainer>(
132 filename.str().c_str(),
136 if (result.second ==
false)
138 NS_FATAL_ERROR(
"SatFadingOutputTraceContainer::AddNode failed");
141 NS_LOG_INFO(
"Added node with MAC " << key.first <<
" channel type " << key.second);
143 return result.first->second;
147 Ptr<SatOutputFileStreamDoubleContainer>
150 NS_LOG_FUNCTION(
this);
152 container_t::iterator iter =
m_container.find(key);
165 NS_LOG_FUNCTION(
this);
167 container_t::iterator iter;
173 iter->second->EnableFigureOutput(
"Fading trace",
178 Gnuplot2dDataset::LINES);
180 iter->second->WriteContainerToFile();
187 NS_LOG_FUNCTION(
this);
191 NS_FATAL_ERROR(
"SatFadingOutputTraceContainer::AddToContainer - Incorrect vector size");
194 Ptr<SatOutputFileStreamDoubleContainer> node =
FindNode(key);
198 node->AddToContainer(newItem);
Base class for trace containers such as interference or fading traces.
static const uint32_t FADING_TRACE_DEFAULT_NUMBER_OF_COLUMNS
Default number of columns for fading traces.
static std::string GetChannelTypeName(ChannelType_t channelType)
static TypeId GetTypeId(void)
NS-3 type id function.
void AddToContainer(key_t key, std::vector< double > newItem)
Add the vector containing the values to container matching the key.
bool m_enableFigureOutput
Switch for figure output.
std::pair< Address, SatEnums::ChannelType_t > key_t
typedef for map key
container_t m_container
Map for containers.
Ptr< SatOutputFileStreamDoubleContainer > AddNode(std::pair< Address, SatEnums::ChannelType_t > key)
Function for adding the node to the map.
Ptr< SatOutputFileStreamDoubleContainer > FindNode(key_t key)
Function for finding the container matching the key.
~SatFadingOutputTraceContainer()
Destructor.
SatFadingOutputTraceContainer()
Constructor.
TypeId GetInstanceTypeId(void) const
NS-3 instance type id function.
void DoDispose()
Do needed dispose actions.
void WriteToFile()
Write the contents of a container matching to the key into a file.
void Reset()
Function for resetting the variables.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.