24 #include "ns3/core-module.h"
26 #include "ns3/satellite-id-mapper.h"
27 #include "ns3/satellite-rx-cno-input-trace-container.h"
28 #include "ns3/singleton.h"
30 NS_LOG_COMPONENT_DEFINE(
"SatelliteCnoHelper");
35 NS_OBJECT_ENSURE_REGISTERED(SatCnoHelper);
41 TypeId(
"ns3::SatCnoHelper").SetParent<Object>().AddConstructor<SatCnoHelper>();
48 NS_LOG_FUNCTION(
this);
57 Config::Set(
"/ChannelList/*/$ns3::SatChannel/RxPowerCalculationMode",
62 : m_satHelper(satHelper),
65 Config::Set(
"/ChannelList/*/$ns3::SatChannel/RxPowerCalculationMode",
81 NS_FATAL_ERROR(
"Can only apply custom GWs C/N0 on feeder channels");
85 NS_FATAL_ERROR(
"Trying to set custom C/N0 several time for same node and channel");
103 NS_FATAL_ERROR(
"Can only apply custom UTs C/N0 on user channels");
107 NS_FATAL_ERROR(
"Trying to set custom C/N0 several time for same node and channel");
135 for (uint32_t i = 0; i < nodes.GetN(); i++)
144 for (uint32_t i = 0; i < nodes.GetN(); i++)
155 NS_FATAL_ERROR(
"Can only apply custom GWs C/N0 on feeder channels");
159 NS_FATAL_ERROR(
"Trying to set custom C/N0 several time for same node and channel");
177 NS_FATAL_ERROR(
"Can only apply custom UTs C/N0 on user channels");
181 NS_FATAL_ERROR(
"Trying to set custom C/N0 several time for same node and channel");
209 Singleton<SatRxCnoInputTraceContainer>::Get()->Reset();
211 std::pair<Address, SatEnums::ChannelType_t> key;
217 for (uint32_t i = 0; i <
m_satHelper->GetBeamHelper()->GetGwNodes().GetN(); i++)
219 gwNode =
m_satHelper->GetBeamHelper()->GetGwNodes().Get(i);
220 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetGwMacWithNode(gwNode),
222 Singleton<SatRxCnoInputTraceContainer>::Get()->SetRxCno(key, 0);
223 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetGwMacWithNode(gwNode),
225 Singleton<SatRxCnoInputTraceContainer>::Get()->SetRxCno(key, 0);
228 for (uint32_t i = 0; i <
m_satHelper->GetBeamHelper()->GetUtNodes().GetN(); i++)
230 utNode =
m_satHelper->GetBeamHelper()->GetUtNodes().Get(i);
231 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetUtMacWithNode(utNode),
233 Singleton<SatRxCnoInputTraceContainer>::Get()->SetRxCno(key, 0);
234 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetUtMacWithNode(utNode),
236 Singleton<SatRxCnoInputTraceContainer>::Get()->SetRxCno(key, 0);
243 for (uint32_t i = 0; i <
m_satHelper->GetBeamHelper()->GetGwNodes().GetN(); i++)
245 gwNode =
m_satHelper->GetBeamHelper()->GetGwNodes().Get(i);
246 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetGwMacWithNode(gwNode),
248 Singleton<SatRxCnoInputTraceContainer>::Get()->AddNode(key);
249 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetGwMacWithNode(gwNode),
251 Singleton<SatRxCnoInputTraceContainer>::Get()->AddNode(key);
254 for (uint32_t i = 0; i <
m_satHelper->GetBeamHelper()->GetUtNodes().GetN(); i++)
256 utNode =
m_satHelper->GetBeamHelper()->GetUtNodes().Get(i);
257 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetUtMacWithNode(utNode),
259 Singleton<SatRxCnoInputTraceContainer>::Get()->AddNode(key);
260 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetUtMacWithNode(utNode),
262 Singleton<SatRxCnoInputTraceContainer>::Get()->AddNode(key);
271 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetGwMacWithNode(params.node),
276 key = std::make_pair(Singleton<SatIdMapper>::Get()->GetUtMacWithNode(params.node),
282 Singleton<SatRxCnoInputTraceContainer>::Get()->SetRxCno(key, params.cno);
287 Singleton<SatRxCnoInputTraceContainer>::Get()->SetRxCnoFile(key, params.pathToFile);
297 if (params.node == node && params.channelType == channel)
void ApplyConfiguration()
Apply configuration to all the satellite channels Needs to be done after node creation.
void SetGwNodeCnoFile(Ptr< Node > node, SatEnums::ChannelType_t channel, std::string path)
Set a constant C/N0 for one GW node and one channel direction.
static TypeId GetTypeId(void)
Get the type ID.
bool m_useTraces
Use C/N0 input traces instead of power calculation from antenna gain.
std::vector< cnoCustomParams_s > m_customCno
Array storing manual C/N0 updates (constant or custom file)
void UseTracesForDefault(bool useTraces)
Set m_useTraces attribute.
void SetUtNodeCnoFile(Ptr< Node > node, SatEnums::ChannelType_t channel, std::string path)
Set a constant C/N0 for one UT node and one channel direction.
void SetGwNodeCno(Ptr< Node > node, SatEnums::ChannelType_t channel, double cno)
Set a constant C/N0 for one GW node and one channel direction.
bool CheckDuplicate(Ptr< Node > node, SatEnums::ChannelType_t channel)
Verify if a node has already been set.
TypeId GetInstanceTypeId(void) const
Get the type ID of object instance.
void SetUtNodeCno(Ptr< Node > node, SatEnums::ChannelType_t channel, double cno)
Set a constant C/N0 for one UT node and one channel direction.
Ptr< SatHelper > m_satHelper
Pointer to the SatHelper objet.
SatCnoHelper()
Default constructor.
ChannelType_t
Types of channel.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.
Struct for storing the custom C/N0 for some nodes.
SatEnums::ChannelType_t channelType