26#include "ns3/boolean.h"
27#include "ns3/singleton.h"
28#include "ns3/string.h"
37NS_LOG_COMPONENT_DEFINE(
"SatRxPowerOutputTraceContainer");
47 static TypeId tid = TypeId(
"ns3::SatRxPowerOutputTraceContainer")
49 .AddConstructor<SatRxPowerOutputTraceContainer>();
56 NS_LOG_FUNCTION(
this);
61 NS_LOG_FUNCTION(
this);
69 NS_LOG_FUNCTION(
this);
73 SatBaseTraceContainer::DoDispose();
79 NS_LOG_FUNCTION(
this);
90Ptr<SatOutputFileStreamDoubleContainer>
93 NS_LOG_FUNCTION(
this);
95 std::stringstream filename;
98 int32_t gwId = Singleton<SatIdMapper>::Get()->GetGwIdWithMac(key.first);
99 int32_t utId = Singleton<SatIdMapper>::Get()->GetUtIdWithMac(key.first);
100 int32_t beamId = Singleton<SatIdMapper>::Get()->GetBeamIdWithMac(key.first);
102 if (beamId < 0 || (utId < 0 && gwId < 0))
108 if (utId >= 0 && gwId < 0)
110 filename << dataPath <<
"/rx_power_output_trace_BEAM_" << beamId <<
"_UT_" << utId
114 if (gwId >= 0 && utId < 0)
116 filename << dataPath <<
"/rx_power_output_trace_BEAM_" << beamId <<
"_GW_" << gwId
120 std::pair<container_t::iterator, bool> result =
m_container.insert(
122 CreateObject<SatOutputFileStreamDoubleContainer>(
123 filename.str().c_str(),
127 if (result.second ==
false)
129 NS_FATAL_ERROR(
"SatRxPowerOutputTraceContainer::AddNode failed");
132 NS_LOG_INFO(
"Added node with MAC " << key.first <<
" channel type " << key.second);
134 return result.first->second;
138Ptr<SatOutputFileStreamDoubleContainer>
141 NS_LOG_FUNCTION(
this);
143 container_t::iterator iter =
m_container.find(key);
156 NS_LOG_FUNCTION(
this);
158 container_t::iterator iter;
164 iter->second->EnableFigureOutput(
"Rx power density",
166 "Rx power (dBW / Hz)",
169 Gnuplot2dDataset::LINES);
171 iter->second->WriteContainerToFile();
178 NS_LOG_FUNCTION(
this);
182 NS_FATAL_ERROR(
"SatRxPowerOutputTraceContainer::AddToContainer - Incorrect vector size");
185 Ptr<SatOutputFileStreamDoubleContainer> node =
FindNode(key);
189 node->AddToContainer(newItem);
SatBaseTraceContainer()
Constructor.
static const uint32_t RX_POWER_TRACE_DEFAULT_NUMBER_OF_COLUMNS
Default Rx C/N0 index for C/N0 traces.
static std::string GetChannelTypeName(ChannelType_t channelType)
static Ptr< SatEnvVariables > GetInstance()
Class for Rx power output trace container.
Ptr< SatOutputFileStreamDoubleContainer > AddNode(std::pair< Address, SatEnums::ChannelType_t > key)
Function for adding the node to the map.
void Reset()
Function for resetting the variables.
static TypeId GetTypeId(void)
NS-3 type id function.
~SatRxPowerOutputTraceContainer()
Destructor.
Ptr< SatOutputFileStreamDoubleContainer > FindNode(key_t key)
Function for finding the container matching the key.
SatRxPowerOutputTraceContainer()
Constructor.
std::pair< Address, SatEnums::ChannelType_t > key_t
typedef for map key
void WriteToFile()
Write the contents of a container matching to the key into a file.
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.
container_t m_container
Map for containers.
void DoDispose()
Do needed dispose actions.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.