23 #include "../utils/satellite-env-variables.h"
26 #include <ns3/boolean.h>
27 #include <ns3/singleton.h>
28 #include <ns3/string.h>
37 NS_LOG_COMPONENT_DEFINE(
"SatRxPowerOutputTraceContainer");
42 NS_OBJECT_ENSURE_REGISTERED(SatRxPowerOutputTraceContainer);
47 static TypeId tid = TypeId(
"ns3::SatRxPowerOutputTraceContainer")
49 .AddConstructor<SatRxPowerOutputTraceContainer>();
56 NS_LOG_FUNCTION(
this);
62 : m_enableFigureOutput(true)
64 NS_LOG_FUNCTION(
this);
69 NS_LOG_FUNCTION(
this);
77 NS_LOG_FUNCTION(
this);
81 SatBaseTraceContainer::DoDispose();
87 NS_LOG_FUNCTION(
this);
98 Ptr<SatOutputFileStreamDoubleContainer>
101 NS_LOG_FUNCTION(
this);
103 std::stringstream filename;
104 std::string dataPath = Singleton<SatEnvVariables>::Get()->GetOutputPath();
106 int32_t gwId = Singleton<SatIdMapper>::Get()->GetGwIdWithMac(key.first);
107 int32_t utId = Singleton<SatIdMapper>::Get()->GetUtIdWithMac(key.first);
108 int32_t beamId = Singleton<SatIdMapper>::Get()->GetBeamIdWithMac(key.first);
110 if (beamId < 0 || (utId < 0 && gwId < 0))
116 if (utId >= 0 && gwId < 0)
118 filename << dataPath <<
"/rx_power_output_trace_BEAM_" << beamId <<
"_UT_" << utId
122 if (gwId >= 0 && utId < 0)
124 filename << dataPath <<
"/rx_power_output_trace_BEAM_" << beamId <<
"_GW_" << gwId
128 std::pair<container_t::iterator, bool> result =
m_container.insert(
130 CreateObject<SatOutputFileStreamDoubleContainer>(
131 filename.str().c_str(),
135 if (result.second ==
false)
137 NS_FATAL_ERROR(
"SatRxPowerOutputTraceContainer::AddNode failed");
140 NS_LOG_INFO(
"Added node with MAC " << key.first <<
" channel type " << key.second);
142 return result.first->second;
146 Ptr<SatOutputFileStreamDoubleContainer>
149 NS_LOG_FUNCTION(
this);
151 container_t::iterator iter =
m_container.find(key);
164 NS_LOG_FUNCTION(
this);
166 container_t::iterator iter;
172 iter->second->EnableFigureOutput(
"Rx power density",
174 "Rx power (dBW / Hz)",
177 Gnuplot2dDataset::LINES);
179 iter->second->WriteContainerToFile();
186 NS_LOG_FUNCTION(
this);
190 NS_FATAL_ERROR(
"SatRxPowerOutputTraceContainer::AddToContainer - Incorrect vector size");
193 Ptr<SatOutputFileStreamDoubleContainer> node =
FindNode(key);
197 node->AddToContainer(newItem);
Base class for trace containers such as interference or fading traces.
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)
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.
TypeId GetInstanceTypeId(void) const
NS-3 instance type id function.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.