23 #include "../utils/satellite-env-variables.h"
26 #include <ns3/boolean.h>
27 #include <ns3/singleton.h>
28 #include <ns3/string.h>
30 NS_LOG_COMPONENT_DEFINE(
"SatRxPowerOutputTraceContainer");
35 NS_OBJECT_ENSURE_REGISTERED(SatRxPowerOutputTraceContainer);
40 static TypeId tid = TypeId(
"ns3::SatRxPowerOutputTraceContainer")
42 .AddConstructor<SatRxPowerOutputTraceContainer>();
49 NS_LOG_FUNCTION(
this);
55 : m_enableFigureOutput(true)
57 NS_LOG_FUNCTION(
this);
62 NS_LOG_FUNCTION(
this);
70 NS_LOG_FUNCTION(
this);
74 SatBaseTraceContainer::DoDispose();
80 NS_LOG_FUNCTION(
this);
91 Ptr<SatOutputFileStreamDoubleContainer>
94 NS_LOG_FUNCTION(
this);
96 std::stringstream filename;
97 std::string dataPath = Singleton<SatEnvVariables>::Get()->GetOutputPath();
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 <<
"/rx_power_output_trace_BEAM_" << beamId <<
"_UT_" << utId
115 if (gwId >= 0 && utId < 0)
117 filename << dataPath <<
"/rx_power_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(
"SatRxPowerOutputTraceContainer::AddNode failed");
133 NS_LOG_INFO(
"Added node with MAC " << key.first <<
" channel type " << key.second);
135 return result.first->second;
139 Ptr<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(
"Rx power density",
167 "Rx power (dBW / Hz)",
170 Gnuplot2dDataset::LINES);
172 iter->second->WriteContainerToFile();
179 NS_LOG_FUNCTION(
this);
183 NS_FATAL_ERROR(
"SatRxPowerOutputTraceContainer::AddToContainer - Incorrect vector size");
186 Ptr<SatOutputFileStreamDoubleContainer> node =
FindNode(key);
190 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.